June 20, 2013
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
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