assert and enforce both compiled out with -release

kdevel kdevel at vogtner.de
Sat Jan 27 14:36:51 UTC 2018


On Saturday, 27 January 2018 at 14:31:13 UTC, Ali Çehreli wrote:
> > But assert is also ignored in release mode:
>
> The documentation is not clear. "they will be compiled out" 
> means "contracts are compiled out". So, an enforce() would 
> disappear if it's inside such a block, which should not be what 
> the programmer wants for an enforce().

The documentation was clear as glass (but wrong): "Use assert in 
contracts."

> Fixed it through the "Improve this page" link on that Phobos 
> page:
>
>   https://github.com/dlang/phobos/blob/master/std/exception.d

"Use $(D assert) in contracts." is still in there.


More information about the Digitalmars-d-learn mailing list