www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D linker

reply novice2 <novice2_member pathlink.com> writes:
I hear than Digital Mars D compiler using OPTLINK linker, and it have
optimization. But when i compile app even with -release and -O switches, then
text constants present in result exe at least twice.
Compile this 2 lines

const char[] TXT = "1a2b3\n";
void main() { printf(TXT);}

and you can see "1a2b3" string in exe 2 times. For what? Can i enable some other
switches to more optimized code?

Thanx.
Oct 14 2005
parent "Walter Bright" <newshound digitalmars.com> writes:
"novice2" <novice2_member pathlink.com> wrote in message
news:dinsbb$2hgt$1 digitaldaemon.com...
 I hear than Digital Mars D compiler using OPTLINK linker, and it have
 optimization. But when i compile app even with -release and -O switches,
then
 text constants present in result exe at least twice.
 Compile this 2 lines

 const char[] TXT = "1a2b3\n";
 void main() { printf(TXT);}

 and you can see "1a2b3" string in exe 2 times. For what? Can i enable some
other
 switches to more optimized code?
Take the 'const' off and it should only appear once.
Oct 15 2005