On 07/30/2014 06:43 PM, 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.
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.
Isn't this also true for assert statements?