Shalom, Enumerations are stronger types than integral values. You can't assign one enumeration variable to another if they don't have the same name, even if the base types of those enumerations are the same. The auto-cast is a convenience that lets you convert an enumerated type to an integral value without an explicit cast. See section 6.9.2 for a description of equivalent types. In regard to the nest() method, when the enumerated values are not in ascending numerical order, it's not just a trivial matter to bump up the values to the Nth member. Note that if you use a four state type, the default value is X. Dave ________________________________________ From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Bresticker, Shalom Sent: Monday, October 31, 2005 12:45 AM To: sv-bc@eda.org Subject: [sv-bc] 4.10.4 "Enumerated types in numerical expressions" - unclearness Hi, I found two unclear points in section 4.10.4. Paragraph 3 says, "An enum variable or identifier used as part of an expression is automatically cast to the base type of the enum declaration (either explicitly or using int as the default)." This is confusing. Doesn't an enum variable already have the type of the declaration by virtue of the declaration itself? Isn't that the very purpose of the declaration? After all, we don't say that a byte variable, for example, is cast to the type of its declaration. Furthermore, 4.10.3 says that "enumerated variables are auto-cast into integral values". The other point I found confusing is in 4.10.4.3 "next()". First it says that "A wrap to the start of the enumeration occurs when the end of the enumeration is reached." Then it says that "If the given value is not a member of the enumeration, the next() method returns the default initial value for the enumeration." I don't know how to reconcile these. What is the case being described, that "the given value is not a member of the enumeration"? I would think that it would just keep wrapping around as many times as necessary to get to the Nth next value. Thanks, Shalom Shalom Bresticker Intel Jerusalem LAD DA +972 2 589-6852Received on Mon Oct 31 08:32:41 2005
This archive was generated by hypermail 2.1.8 : Mon Oct 31 2005 - 08:33:56 PST