checkedint call removal

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 30 11:17:09 PDT 2014


On 7/30/14, 11:13 AM, Ary Borenszweig wrote:
> On 7/30/14, 2:56 PM, Andrei Alexandrescu wrote:
>> On 7/30/14, 9:31 AM, Timon Gehr wrote:
>>> On 07/30/2014 05:04 PM, Andrei Alexandrescu wrote:
>>>> On 7/30/14, 4:56 AM, Daniel Murphy wrote:
>>>>> "Artur Skawina via Digitalmars-d"  wrote in message
>>>>> news:mailman.217.1406713015.16021.digitalmars-d at puremagic.com...
>>>>>
>>>>>> `assert` is for *verifying* assumptions. It must not allow them
>>>>>> to leak/escape. Otherwise a single not-100%-correct assert could
>>>>>> defeat critical runtime checks.
>>>>>
>>>>> All you're saying is you want them to have different names, not
>>>>> that it
>>>>> can't work the way Walter and I have described.  If your assertions
>>>>> are
>>>>> invalid and you're compiling with -release, the compiler is free to
>>>>> generate invalid code.  -release is dangerous.  -release is telling
>>>>> the
>>>>> compiler that the code you wrote is correct,  and it can rely on it to
>>>>> be correct.
>>>>
>>>> Exactly! -- Andrei
>>>
>>> This just moves the issue around and gives another term a non-obvious
>>> meaning (the 'release' switch, which is not called e.g.
>>> 'unsafeAssumeCorrect'.
>>
>> Well to me "-release" is "I assume my program is correct, generate the
>> fastest code for it".
>
> I tried the program in debug mode in thousands of ways and apparently no
> assert triggers. So I'll just compile in release mode, release it and
> let anyone find bugs in it and allow to bypass any security or safety I
> put in my program with those "assert" statmenets, that would probably
> just take 1 nanosecond to execute anyway.
>
> Sounds really nice.
>
> (sorry for the sarcasm, removing assert is wrong to me)

Sometimes it's wrong sometimes it's required. I think there is an 
understanding that sometimes every extra bit of speed is necessary. We 
wouldn't imagine deploying hhvm with assertions enabled.

Andrei



More information about the Digitalmars-d mailing list