manifest enum

John Reimer terminal.node at gmail.com
Tue Jan 1 14:28:28 PST 2008


YDerek Parnell wrote:

> 
> There is no difference between a group of manifest constants and a single
> manifest constant.
> 
>   enum x = 3;
>   enum y = "four";
> 
> and
> 
>   enum {x = 3, y = "four"};
> 
> are semantically identical.
> 
> The documenation says this ...
> 
> "If there is only one member of an anonymous enum, the { } can be omitted".
> 

Yep, I read that.

But it wasn't clear to me that the following statement applied to 
anonymous enums also:

"such declarations are not lvalues, meaning their address cannot be taken."

The fact that both these statements were in a separate section titled 
"Manifest Constants" made it look like these were treated as an 
independent entity from "Anonymous Enums", the section just before it.

Perhaps I should have inferred that the prhase "the { } can be omitted" 
indicated they were one and the same, but I still think it's somewhat 
unclearly documented.

If anonymous enums and manifest constants are the same, then the section 
"Manifest Constants" should probably be removed and the sections merged. 
  A reference can be made to the fact that these represent two different 
forms of manifest constants. Then the statement on lvalue would be taken 
to refer to both forms.

-JJR



More information about the Digitalmars-d mailing list