manifest enum
John Reimer
terminal.node at gmail.com
Tue Jan 1 12:02:04 PST 2008
This may have been asked before, but the documentation isn't clear:
With the new enum in D 2.0, is there a difference between a singly
declared manifest:
enum i=4;
and the anonymous enum block:
enum {
A = 1.2f,
B = 2L,
C = 3
}
The docs say that the singly declared manifest enum is not an lvalue and
it's address can be taken (which is eaasy to understand). However, does
this apply to the anonymous enum in the second case also?
Put another way, does the second case classify as a /list/ of manifest
enums?
If the two are not the same... then a I guess a manifest enum has to be
declared every line with "enum" in front which would become rather
painfully redundant given that other structures in the language allow
you to group several declarations in a block (extern).
On the other hand if an anonymous enum block /is/ the same as a single
manifest constant, then it becomes confusing and hard to differentiate
the old enum type in a listing from the manifest enums. Maybe this was
one of the arguments against it in earlier discussions?
I can settle for the name "enum", but it does seem to add a unusual
level of confusion. Granted I'm probably bringing up something that's
been hashed over in previous discussions already.
-JJR
More information about the Digitalmars-d
mailing list