On Wednesday, 30 July 2014 at 16:43:47 UTC, Daniel Murphy wrote:
"John Colvin" wrote in message news:mmnpehpddzkduycyd...@forum.dlang.org...

So what is the recommended way of inserting a check of the sort that Ola would like?

debug enforce(expr);

perhaps? Seeing as that statement is completely missing outside of debug mode, the compiler can't do anything much about it.

Don't use -release.

haha yeah, or that!

P.S. What about version(assert)? Could the optimiser work with this:

if(x > 7) x++;
version(assert) auto testResult = x;
assert(x <= 7);

No, version(assert) is just about doing introspection on the compiler's configuration. In release mode that code doesn't even get semantically analysed.

pity.

Reply via email to