debugging code with mixins

Iain Buclaw ibuclaw at ubuntu.com
Thu Dec 2 15:25:10 PST 2010


== Quote from Trass3r (un at known.com)'s article
> I often use mixins in my code.
> This is nice programming-wise but really becomes painful when trying to
> debug cause it completely messes up dmd's line numbers.
> Is there any solution to this in D?
> Could we have some sort of "preprocessed source code" and use that for
> debugging?

Use #line on the first line of the mixin.

ie:
const gen_variant = `
    #line 42
    int ` ~ name ~ ` = 4.2f; // <- This is the real line 42 in the source file

`;


Regards


More information about the Digitalmars-d mailing list