assume, assert, enforce, @safe

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 31 00:36:46 PDT 2014


On 7/31/2014 12:01 AM, simendsjo wrote:
> On 07/31/2014 12:01 AM, Walter Bright wrote:
> (...)
>> 2. The compiler can make use of assert expressions to improve
>> optimization, even in -release mode.
> (...)
>
> Does this mean that assertions used for optimization will be left in
> -release? There's plenty of times where I've had an old incorrect
> assertion in my code after a refactoring - sometimes in seldom used paths.
>
> If the compiler would aggressively optimize my code based on some wrong
> assumptions I give it, it would be very useful if that assumption would
> stay in the code to trigger an assertion.

To get this behavior, don't use the -release switch.



More information about the Digitalmars-d mailing list