Version() for unittest OR debug?

Juanjo Alvarez via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 11 02:39:43 PDT 2014


On Tuesday, 10 June 2014 at 14:06:58 UTC, bearophile wrote:
> Juanjo Alvarez:
>
>> Probably I pretty simple question, how could I mark some code 
>> to be compiled when in debug OR unittest mode? (or both, ||)
>>
>> At first I tough I could do:
>>
>> version(unittest, debug) {}
>
> You can define a enum boolean value in the version unittest 
> block, and another inside the debug {} else {}. And then you 
> can use "if (b1 || b2) { ... }".
>
> Bye,
> bearophile

Not pretty, but works.

Thanks!


More information about the Digitalmars-d-learn mailing list