Feature for paranoids

ponce via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 10 07:44:15 PST 2015


On Tuesday, 10 November 2015 at 13:09:09 UTC, Fyodor Ustinov 
wrote:
> Hi!
>
> Is it possible when using the "-release" indicate that this one 
> in/out/invariant/assert should not to be disabled?
>
> WBR,
>     Fyodor.

Since assert(false) is special (cf. 
http://p0nce.github.io/d-idioms/#assert%28false%29-is-special) 
you can use the following construct to have always-on assertions:

     if (!cond)
         assert(false);

instead of:

     assert(cond);


But -release will still remove your in/out/invariant blocks.


More information about the Digitalmars-d-learn mailing list