assume, assert, enforce, @safe
eles via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jul 31 22:27:47 PDT 2014
On Thursday, 31 July 2014 at 20:49:18 UTC, Timon Gehr wrote:
> On 07/31/2014 09:37 PM, Jonathan M Davis wrote:
>> On Thursday, 31 July 2014 at 18:43:49 UTC, Ary Borenszweig
>> wrote:
>>> On 7/31/14, 4:37 AM, Walter Bright wrote:
>>>> On 7/30/2014 4:05 PM, Ary Borenszweig wrote:
>>>>> On 7/30/14, 7:01 PM, Walter Bright wrote:
> Disabling assertions (and whatnot), assuming assertions to be
> true (and disabling whatnot) and leaving all assertions and
> whatnot in are different trade-offs, of which assuming all
> assertions to be true is the most dangerous one. Why hide this
> behaviour in '-release'?
But assertions are *always* assumed to be true. The sole
difference is that in Debug mode actual code generation for their
check is disabled (not exactly the assertions, but code testing
them).
The compiler makes no guarantee on the code that comes after an
assert other than it will work correctly *if the assertion
holds*. This is true for the code generated in both Debug and
Release builds.
The difference is in the level of optimization (to play nice with
gdb) and checks: in the Debug mode, that "assert-compelling
generated code" never gets to actually execute as the program
chocks at the assertion point (that is, just before entering the
code).
More information about the Digitalmars-d
mailing list