Program logic bugs vs input/environmental errors

Johannes Pfau via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 29 01:18:27 PDT 2014


Am Sun, 28 Sep 2014 17:47:56 -0700
schrieb Walter Bright <newshound2 at digitalmars.com>:

> On 9/28/2014 4:18 PM, Joseph Rushton Wakeling via Digitalmars-d wrote:
> > I don't follow this point.  How can this approach work with
> > programs that are built with the -release switch?
> 
> All -release does is not generate code for assert()s. To leave the
> asserts in, do not use -release. If you still want the asserts to be
> in even with -release,
> 
>      if (condition) assert(0);
> 

Right now, but some time ago there was a huge debate whether it should
be valid for the compiler to optimize based on asserts.

I wonder if these 'use asserts for stack traces' and 'an assert is
always supposed to pass, so it's valid to assume the condition holds
(in release)' notions can go together. I guess it might at least lead
to programs that are unusable when compiled with -release.


More information about the Digitalmars-d mailing list