Why assert is in the language?

Ali Çehreli acehreli at yahoo.com
Tue Jun 22 15:36:35 PDT 2010


Jonathan M Davis wrote:
 > Steven Schveighoffer wrote:

 >> all calls to assert are removed by the compiler in release mode.  I 
don't
 >> think there's a way to implement that via a library (it would be nice
 >> though!)

 > Also IIRC, the compiler uses assert(0) to ensure that functions blow 
up at
 > runtime if you manage to hit the end of them without a return statement.

I just read in TDPL that the assert(0) calls in user code are not 
removed even in release mode.

Ali


More information about the Digitalmars-d-learn mailing list