Where to put Assertions?

Posted by sud03r on Stack Overflow See other posts from Stack Overflow or by sud03r
Published on 2011-01-31T07:17:25Z Indexed on 2011/01/31 7:25 UTC
Read the original article Hit count: 173

Filed under:
|

Hi,

Having assertions for unexpected conditions is considered to be good defensive coding practice. I happen to place assertions whenever i think something unexpected may happen, but that now seems to be an overkill to me.

Additionally, sometimes mild unexpected conditions that don't necessarily lead to crash may even cause failure on customer end.

Is there a hard and fast rule to put assertions?

Thanks.

© Stack Overflow or respective owner

Related posts about c++

Related posts about production-environment