
9 Oct
2005
9 Oct
'05
10:14 p.m.
Dave Harris wrote:
In-Reply-To: <4343103A.6010007@dcook.org> darren@dcook.org (Darren Cook) wrote (abridged):
I think it is fair to assume people don't have assert(false) in code that is ready for release - it is just used temporarily during debugging.
No, it isn't fair to assume that. I have:
if (e) { assert(false); throw "can't happen"; }
or similar in release code.
Isn't that an abuse of assert? IOW, shouldn't you either make it exclusively a debug mode check, or make it a check in both modes? It seems that that should either become: assert ( !e ); or: if ( e ) throw "can't happen"; Why do you need both types of checks in the same place? -Jason