assume, assert, enforce, @safe
Dicebot via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 30 18:16:41 PDT 2014
On Wednesday, 30 July 2014 at 23:50:51 UTC, H. S. Teoh via
Digitalmars-d wrote:
> But if you don't want to check ever to be removed, currently
> you have to
> write:
>
> if (!requiredCondition)
> assert(0); // compiler never removes this
>
> which IMO is relatively clear, and the use of assert(0) for
> forceful
> termination is consistent with existing practice in D code.
Not helping.
```
import std.stdio;
void foo()
in { writeln("in contract"); }
body { }
void main() { foo(); }
```
Compile with -release and check the output.
More information about the Digitalmars-d
mailing list