assert(false)

Ali Çehreli acehreli at yahoo.com
Thu Jun 20 13:28:40 PDT 2013


On 06/20/2013 12:48 PM, Joseph Rushton Wakeling wrote:

 > Is it considered good/recommended practice to insert an assert(false) 
statement
 > in parts of the code that should be unreachable?  Or simply an 
optional choice
 > that may be useful for debugging?

And a reminder that assert(false) (and assert(0)) is never removed from 
code (even when other asserts are). So, they are always there to prevent 
the program from producing unexpected results.

Ali



More information about the Digitalmars-d-learn mailing list