checkedint call removal

Daniel Murphy via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 30 09:43:48 PDT 2014


"John Colvin"  wrote in message news:mmnpehpddzkduycydcnh at 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. 



More information about the Digitalmars-d mailing list