Mantis 1429 points out an exception. If the expression is simply the enum variable or an enum value name, it remains an enum type. Otherwise you could not write c = green; // legal; c is an enum variable because green would be cast to an int, bringing us to c = 1 ; // illegal Shalom > >> I would say that you need to normalize only if the types > of then- and > >> else- expressions do not match. If the types are matching (or > >> "same"), it would be more useful to let the conditional operator > >> return this type, rather than to artificially normalize > it. This is > >> especially true for non-integral types. > > > >Especially true for enum types (which shouldn't reduce to > integers here). > > While this may seem reasonable at first glance, a closer look > shows that they do reduce to integral values here, and need to. > > The LRM says "An enum variable or identifier used as part of > an expression is automatically cast to the base type of the > enum declaration." So it is clear that they do reduce to > integers here. There are reasons why they need to. --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Wed Oct 17 02:20:53 2007
This archive was generated by hypermail 2.1.8 : Wed Oct 17 2007 - 02:21:01 PDT