Idiom for debug printf?

0ffh spam at frankhirsch.net
Sun Sep 30 19:42:51 PDT 2007


Bill Baxter wrote:
> version(Verbose) {
>    alias writefln debugfln;
> }
> else {
>    ... what goes here? ...
> }
> 
> The idea is that it should work just like a call to writefln in the 
> version=Verbose case, but it should be a complete no-op otherwise 
> (meaning it also shouldn't evaluate its arguments).

No idea what it /should/ be done like, but in the else case I use
"void debugfln(...) {}" and rely on compiler optimisation... :)

Regards, Frank


More information about the Digitalmars-d-learn mailing list