Automatic invariant generation

Nicholas Wilson via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 9 04:24:05 PDT 2017


On Sunday, 9 July 2017 at 11:13:02 UTC, Walter Bright wrote:
> On 7/7/2017 7:08 AM, Nicholas Wilson wrote:
>> It is certainly unacceptable in the long run to demand that if 
>> users wish to use DCompute that they can't have asserts _in 
>> the code running in the host_.
>
> One thing you can do is replace:
>
>     assert(i > 3);
>
> with:
>
>     if (!(i > 3)) assert(0);
>
> which won't be removed with -release, and the only bloat will 
> be a lovely HLT instruction.

Of course I could do that for _my_ code , but I am not every end 
user, and even if I was doing the above is not a good use of my 
time.

And this wouldn't be so bad if it were code that I or someone 
else had written, but the fact that the compiler inserts it and I 
didn't ask for it and, save from hacking the compiler, I can't 
make it do otherwise.


More information about the Digitalmars-d mailing list