July 10, 2009 Release binary | ||||
---|---|---|---|---|
| ||||
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? |
July 13, 2009 Re: Release binary | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Voinkov | 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.
|
Copyright © 1999-2021 by the D Language Foundation