Re: Const and enum optimizations

2013-01-03 Thread Jonathan M Davis
On Thursday, January 03, 2013 13:34:16 Ali Çehreli wrote: > 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

Re: Const and enum optimizations

2013-01-03 Thread Ali Çehreli
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 macr

Re: Const and enum optimizations

2013-01-03 Thread Phil Lavoie
But if your concern is const variables at module scope being optimized out of existence, it is my understanding that they won't be. All right, thanks for your answer! My concern is indeed const variable at module scope. I felt like using enums for #define translations were more appropriate, a

Re: Const and enum optimizations

2013-01-03 Thread Jonathan M Davis
On Thursday, January 03, 2013 16:58:11 Phil Lavoie wrote: > Hi, > > I have a question concerning compiler optimizations and their > likelihood for const vs. enum declarations. > > I came across some code recently that had a bunch of const > declarations that were extracted from a C header. In thi

Const and enum optimizations

2013-01-03 Thread Phil Lavoie
Hi, I have a question concerning compiler optimizations and their likelihood for const vs. enum declarations. I came across some code recently that had a bunch of const declarations that were extracted from a C header. In this very header, those definitions are in fact #define clauses. I w