checkedint call removal

Ary Borenszweig via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 30 11:01:24 PDT 2014


On 7/30/14, 2:59 PM, Ary Borenszweig wrote:
> On 7/30/14, 2:47 PM, Daniel Murphy wrote:
>> "Ary Borenszweig"  wrote in message news:lrba7m$5o4$1 at digitalmars.com...
>>> So assume stays there in release mode and makes the program crash if
>>> it doesnt' hold?
>>
>> Yes.  Well, might make it crash.  Might make it just give the wrong
>> result.
>
> So... it's exactly the same as assert?

Sorry, I misunderstood your answer.

If assume stays in release mode then that's the difference. The problem 
then is that assert doesn't stay in release mode so the compiler can't 
make any assumption about the code that follows the "assert" because 
asserts are removed in release mode.

In my opinion, removing asserts in release-mode is the big problem here. 
How expensive can an assert be? Do you really want to debug that? 
Wouldn't it be better to get an exception?

If the compiler *never* removes asserts, then assert and assume have the 
same meaning.


More information about the Digitalmars-d mailing list