Re: Is 'enum Colour : int { red, green, blue };' legal?
Bo Persson wrote:
"Victor Bazarov" <v.Abazarov@comAcast.net> skrev i meddelandet
news:e61uih$5o8$1@news.datemas.de...
Jorn Ronnow wrote:
I'm a bit confused here, since the help in M$ Visual Studio 2005
states the syntax for enum as:
enum [tag] [: type] {enum-list} [declarator];
So, it would be possible to write:
enum Protocol_t : unsigned char { ICMP = 1, TCP = 6, UDP = 17 };
struct IPHeader {
// ...
Protocol_t Protocol;
// ...
};
It sounds like an M$ specific extension to me, but it's not listed
as
such in VS2005's help section "Microsoft Extensions to C and C++".
On
the other hand, it's not included in Schildt's "C++: The Complete
Reference" (4th ed, 2003).
First and foremost, good that you asked here. At least
knowledgeable
people will read and answer. AFAIK, the "[: type]" is non-standard.
But it is *a* standard, ECMA-372 The C++/CLI language
http://www.ecma-international.org/publications/standards/Ecma-372.htm
Confusing, isn't it? :-)
The only Standard relevant _here_ is ISO/IEC 14992:2003. *It* makes
no reference to the one you named ("ECMA-372", whatever that is). No
confusion here, AFAICT.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask