Assert and the optional Message

Jonathan M Davis jmdavisProg at gmx.com
Fri Mar 9 00:43:06 PST 2012


On Friday, March 09, 2012 09:20:33 Chris Pons wrote:
> Any idea why, system("PAUSE") does work?

Because that line never gets run. A failed assertion throws an AssertError 
which skips everything until it gets handled by the runtime after it exits 
main. So, if you have

assert(condition);
system("PAUSE");

the second line will never execute as long as condition is false.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list