checkedint call removal

via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 30 12:09:41 PDT 2014


On Wednesday, 30 July 2014 at 18:25:43 UTC, H. S. Teoh via 
Digitalmars-d wrote:
> If you want the check to always be there, use enforce, not 
> assert.

Doesn't help:

     module a;
     void bar(int x) {
         assert(x > 0);
         writeln("x = ", x);
     }
     // --------
     module b;
     import a;
     void foo(int x) {
         enforce(x > 0);
         bar(x);
     }

If `assert` is treated like `assume` (under Ola's definitions), 
then `enforce` can be optimized away.


More information about the Digitalmars-d mailing list