[dox] enum specs vs reality

Jacob Carlborg doob at me.com
Wed Aug 28 23:40:32 PDT 2013


On 2013-08-28 17:26, captaindet wrote:

> enum keyword covers both, enumeration constants and manifest constants.
> the specs cover both in one. moreover, they explain that manifest
> constants are only syntactic sugar for anonymous enums:
>
> enum { A = 2, B = 4 }
>
> is the same as
>
> enum A = 2;
> enum B = 4;

The above is short for:

enum int A = 2;
enum int B = 4;

They declare manifest constants, not types.

It's the same as:

immutable int A = 2;

But you can't take the address of "A", which you can if it's declared as 
immutable.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list