assert(0)

anonymous via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 7 12:49:48 PST 2015


On 07.11.2015 21:38, Fyodor Ustinov wrote:
> 1. I should generally _not_, but I _can_.

D lets you to shoot your own foot, yes. You're encouraged not to do it, 
though.

> 2. Without "-release" assert(0) launches scope(exit), scope(failure) and
> "finally" blocks. I.e. we get a completely different behavior in
> "-release" and not "-release" mode.

Yeah, -release drastically changes how asserts behave. That's its 
purpose. A program should not fail asserts. If it does, that's a bug. In 
particular, assert(0) should never be reached. If it is reached, that's 
a bug.


More information about the Digitalmars-d mailing list