const again

Kris foo at bar.com
Thu Dec 6 22:30:01 PST 2007


"guslay" <guslay at gmail.com> wrote in message 
news:fjao2r$ii4$1 at digitalmars.com...
> Walter Bright Wrote:
>>
>> Yes for that reason, and the other reason is one rarely wants storage
>> allocated for manifest constants. windows.d has 10,000 declarations in
>> it, who wants 40K of executable bloat from const declarations?
>>
>
> const int x = 1;
>
> Doesn't x get substituted by 1 everywhere in a constant propagation pass?
> I thought it didn't take storage, at least in optimization mode.
>

all those Win32 constants actually adds over 50KB of bloat. Tango would up 
using enum instead, and pulled some silly linker stunts to eliminate the 
bloat. I think you can take the address of a const? 





More information about the Digitalmars-d mailing list