June 20, 2013 debug & optimization | ||||
---|---|---|---|---|
| ||||
Attachments:
| Would:
void test(string s = "default message")
{ debug
{
.........
} // debug
} // test
be optimized away in code that was compiled with debug turned off?
I've documented my code that this is a noop unless debug is true, but I'm not really sure that's correct, or whether there would be a function call
--
Charles Hixson
|
June 20, 2013 Re: debug & optimization | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Hixson | Charles Hixson:
> I've documented my code that this is a noop unless debug is true, but
> I'm not really sure that's correct, or whether there would be a function call
At a low optimization level probably dmd keeps the call to the empty function. At a high optimization level the call probably is optimized away.
Bye,
bearophile
|
Copyright © 1999-2021 by the D Language Foundation