<br><br><div class="gmail_quote">On Fri, Jun 3, 2011 at 6:52 AM, Nick Sabalausky <span dir="ltr"><a@a.a></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
"Lennart Blanco" <<a href="mailto:cokebuttle@gmail.com">cokebuttle@gmail.com</a>> wrote in message<br>
news:mailman.560.1307076213.14074.digitalmars-d@puremagic.com...<br>
<div class="im">> Hi<br>
><br>
> The page for enums specification<br>
</div>> <a href="http://www.digitalmars.com/d/2.0/enum.htmldefines" target="_blank">http://www.digitalmars.com/d/2.0/enum.html defines</a> enum body syntax as<br>
<div class="im">> follows:<br>
><br>
> EnumBody:<br>
> ;<br>
> { EnumMembers }<br>
><br>
> Should it not be<br>
><br>
> EnumBody:<br>
> EnumMember ;<br>
> { EnumMembers }<br>
><br>
> or perhaps<br>
><br>
> EnumBody:<br>
> EnumMembers ;<br>
> { EnumMembers }<br>
><br>
> Otherwise, I can't quite grasp how following enums definitions are legal:<br>
><br>
> enum X = 4;<br>
><br>
> enum<br>
>  mega = 1024 * 1024,<br>
>  pi = 3.14,<br>
>  euler = 2.72,<br>
>  greet = "Hello";<br>
><br>
> (Both of the above enums are accepted by dmd v2.050).<br>
><br>
<br>
</div>It's a poorly-named hack to allow people to create manifest constants. Ie,<br>
they're like immutable values, but they don't actually take up any space in<br>
memory. In other words, it works just like C's "#define SOME_VALUE 5": the<br>
value just gets substituted into the code wherever the name is found.<br></blockquote><div><br></div><div>Yes, I understand how anonymous enums works. My question was regarding the D 2.0 specification document. To me it looks like the syntax for anonymous enums is missing in the specification. Only valid enum body definitions are empty body or a list of enum members, delimited with '{' abd '}'.</div>
<div><br></div><div>/Lennart</div></div><br>