[sv-bc] 4.10.4 "Enumerated types in numerical expressions" - unclearness

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Mon Oct 31 2005 - 00:44:59 PST
  

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-6852 

 




image001.gif
Received on Mon Oct 31 00:45:20 2005

This archive was generated by hypermail 2.1.8 : Mon Oct 31 2005 - 00:47:23 PST