assert(false)

bearophile bearophileHUGS at lycos.com
Thu Jun 20 15:03:52 PDT 2013


Ali Çehreli:

> And a reminder that assert(false) (and assert(0)) is never 
> removed from code (even when other asserts are).

Because in release mode assert(false) is not an assert any more, 
it's an HALT instruction, and it doesn't show the error message:
assert(false, "Not shown in release optimized mode");

I don't like a lot this conflation of a different semantics, but 
after some discussion Walter in the end decided to keep things 
this way, and not introduce a proper different built-in halt 
intrinsic.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list