checkedint call removal
via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 30 14:06:13 PDT 2014
On Wednesday, 30 July 2014 at 20:47:30 UTC, Walter Bright wrote:
> On 7/30/2014 7:36 AM, Ary Borenszweig wrote:
>> Now, if you compile in release mode, according to Walter, all
>> the "asserts" are
>> gone (which, as a side note, is something I don't like: in
>> every case it should
>> throw an AssertError). So the question is: can the compiler
>> still replace that
>> writeln call?
>
> Yes.
This on the other hand is a terrible, terrible misuse of assert.
You need distinguish between what is assumed to hold and what is
proved to hold to chain together pieces of proven programs. So
what one function require (preconditions) you need to assert
before calling the function. On the other hand, what the function
asserts you can assume to hold after the call.
So:
assert(X)
---- function call to precompiled library code
assume(X)
...statements
assert(Y)
---- function return from precompiled library code
assume(Y)
Pretty clear, now huh?
More information about the Digitalmars-d
mailing list