How to make invariant switchable
Denis Koroskin
2korden at gmail.com
Thu Jun 18 06:05:54 PDT 2009
On Thu, 18 Jun 2009 16:57:47 +0400, Qian Xu <quian.xu at stud.tu-ilmenau.de>
wrote:
> Jason House wrote:
>
>> Qian Xu Wrote:
>>
>>> Hi All,
>>>
>>> "invariant" is a great language feature of D. But nice thing costs.
>>>
>>> Is it possible to make it compiler switchable? Like "dmd
>>> --ignore-invariant" or "dmd --version=ignore-invariant" It think it
>>> will
>>> be quite helpful to generate test version and release version of
>>> software.
>>>
>>>
>>> Best regards
>>> Qian Xu
>>
>> "dmd -release" will ignore invariants. You can also wrap your invariants
>> inside of debug{} or similar.
>
> Thanks for the hint.
>
> BTW: is assertion switchable as well? I put some assertions outside of
> invariant-block, it will be executed, when my program is compiled in
> release mode.
No, they wont.
More information about the Digitalmars-d
mailing list