2 problems I can't get my head around

tn no at email.com
Wed Nov 28 05:07:02 PST 2012


On Tuesday, 27 November 2012 at 21:16:41 UTC, Walter Bright wrote:
> On 11/27/2012 9:51 PM, Manu wrote:
>> There's another you missed:
>> enum X = 10;
>> I would have imagined this would be semantically identical to 
>> E.A/E.B,
>> but the compiler seemed to view this as distinct in my 
>> experiments.
>
> Those are not enums, they are manifest constants. What 
> distinguishes a manifest constant from, say:
>
>     const Y = 11;
>
> is that no storage is allocated for X, and X's address cannot 
> be taken.

What distinguishes manifest constants from literals? Aren't 
manifest constants just literal aliases? That is, if the 
following did work

alias Y = 11;

wouldn't that be exactly same as

enum Y = 11;

Perhaps using "alias" instead of "enum" would make the meaning 
clearer?



More information about the Digitalmars-d mailing list