Release binary

Don nospam at nospam.com
Mon Jul 13 04:32:04 PDT 2009


Vladimir Voinkov wrote:
> I've noticed that constant strings are still presented in release bynary:
> 
> static invariant string Abc0 = "abcdefg";
> static const string Abc1 = "abcdefg";
> 
> A source compiles with -O -release and the strings are not referenced. Is linked able to optimize them out?

No, the DMD linker isn't smart enough. (Maybe the LDC one is?)
BTW that's why D2 has 'enum' for manifest constants. It's a language 
hack to work around a linker limitation.


More information about the Digitalmars-d-learn mailing list