assert(0) behavior

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 3 15:54:49 PDT 2015


On 8/3/2015 8:50 AM, Steven Schveighoffer wrote:
> 1. They aren't removed, they are replaced with a nearly useless segfault.

Not useless at all:

1. The program does not continue running after it has failed. (Please, let's not 
restart that debate.
2. Running it under a debugger, the location of the fault will be identified.


> 2. If we are going to put something in there instead of "assert", why not just
> throw an error?

Because they are expensive.

To keep asserts in all their glory in released code, do not use the -release switch.



More information about the Digitalmars-d mailing list