Const and enum optimizations

Ali Çehreli acehreli at yahoo.com
Thu Jan 3 13:34:16 PST 2013


On 01/03/2013 07:58 AM, Phil Lavoie wrote:

 > header.c:
 > #define MY_CONST 1
 > ...
 > module.d:
 > enum {
 > MY_CONST = 1
 > }

Further, there is no need for that anonymous scope in D:

     enum MY_CONST = 1;

Even further, I am one of those who reserve all capitals to macros. 
Since there are no macros in D, this is my choice:

     enum myConst = 1;

I know that there are others who use all capitals for manifest constants 
but I fail to see the benefit of doing that. Nobody wants to or able to 
modify constants anyway. :)

Ali



More information about the Digitalmars-d-learn mailing list