PhobosWatch: manifest => enum

Walter Bright newshound1 at digitalmars.com
Fri Dec 28 13:32:49 PST 2007


Bruce Adams wrote:
> I can see the desire for manifest constants here. You particularly don't 
> want to bloat your code
> with each intermediate value in a compile time computed expression.
> I've just tried an experiment on gcc (cygming 3.4.4). Compiled objects 
> are the same size whether
> enum or static const is used in a factorial template. I see this as 
> evidence that the enum hack
> is still just that, a hack to workaround dodgey compilers. So you are 
> propagating a hack into D
> if the C++ example is one of your primary reasons.

Doesn't "static const" strike you has a hack? It does to me. It has 
unique properties that are not deducible from the meaning of static or 
const by themselves. "const" is also a hack in C++, as "const int" 
sometimes means "const int" and sometimes just "int".



More information about the Digitalmars-d mailing list