passing all writefln arguments
Saaa
empty at needmail.com
Thu Mar 20 17:18:09 PDT 2008
Seems to work, thanks.
> Saaa wrote:
>> Thanks,
>>
>> As I think that changing a variable is easier than changing the compiler
>> line I went with:
>>
>> const bool DEBUGG=false;
>>
>> static if (DEBUGG == true) {
>> alias writefln dWritefln;
>> }
>> else {
>> void dWritefln(...) {}
>> }
>
> I think you can set debug versions inside a file too. That way you can
> have the best of both worlds. Turn it on from the command line, or by
> modifying the file.
>
> debug = DEBUGG;
>
> debug(DEBUGG) {
> alias writefln dWritefln;
> }
> else {
> void dWritefln(...) {}
> }
>
> ... at least that works with 'version'. Not sure if it works with debug
> too. (If it doesn't I'll file a bug about the inconsistency with
> 'version'.)
>
>> Will dWritefln(..){} compile to 'nothing'?
> > I mean, will calling dWritefln when DEBUGG=false take no cpu tick
> (does the
> > compiler see that it does nothing)?
>
>
> Yes. See thread entitled "debug()" over in digitalmars.D.
> digitalmars.com digitalmars.D:66826
> digitalmars.com digitalmars.D:66827
>
> But that may only be with -inline. Not sure what flags Jarrett used when
> he ran the test.
>
> --bb
More information about the Digitalmars-d-learn
mailing list