assert(false)

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jun 20 12:55:37 PDT 2013


On Thu, Jun 20, 2013 at 08:48:38PM +0100, 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?

I consider that good practice, so that when an unexpected code path was
followed, the program terminates instead of proceeding to potentially do
dangerous things.


T

-- 
Curiosity kills the cat. Moral: don't be the cat.


More information about the Digitalmars-d-learn mailing list