Hacker News new | ask | show | jobs
by thesneakin 1305 days ago
Assert usually throws an exception in most environments.
2 comments

> Assert usually throws an exception in most environments.

Not really. In C and C++, an assert() calls std:abort. In custom implementations it does whatever you'd like it to do. I've seen assert() call asm('int13;') out of convenience. I never see an exception once.

...in debug configurations. And compiled out in release configurations. This makes it useless for checking user input. (OK for a library code, when input is validated higher in the stack.)