[dox] enum specs vs reality

Jacob Carlborg doob at me.com
Wed Aug 28 23:38:46 PDT 2013


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

> b) what typeof expects/tolerates seems to be a bit of a minefield by
> itself.
>
> enum test = true;
> writeln( typeof(test).stringof );    //prints: bool
>
> enum wtf;
> writeln( typeof(wtf).stringof );    //Error: argument wtf to typeof is
> not an expression

Actually, I previously misread this. This is working as it should.

The first declares a manifest constant:

enum test = true

Is short for:

enum bool test = ture;

"bool" is the type, "test" is the name.

The second declares a new type, where "wtf" is the name of the type.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list