Bug 3999 and 4261

Daniel Gibson metalcaedes at gmail.com
Tue Aug 31 18:29:11 PDT 2010


bearophile wrote:
> 
> ctconst is a fictional keyword that denotes compile-time constants. Now you are probably able to see that there is no correlation between the n and Color.
> 

Why not use the non-fictional const keyword? "The const attribute 
declares constants that can be evaluated at compile time."[1]

"enum int n = 10;" looks really strange. I don't know if this is needed..
But "enum : int { FOO, BAR, BAZ };" does not look so strange to me and 
I'd prefer this to "const int FOO=0; const int BAR=1; const int BAZ=2;".
The syntax is shorter, it shows that these keywords kind of belong 
together and the values are enumerated automatically.

Cheers,
- Daniel

[1] http://www.digitalmars.com/d/1.0/attribute.html#const


More information about the Digitalmars-d mailing list