News for hackers. Stuff that matters.
Re:Two handy GDB breakpoint tricks by eqvinox on Monday January 29, 2024 @04:18AM (#39174345)
If you're about to fail an assertion (which is semantically similar to a SEGV), you probably shouldn't care about messing up signal handling anymore ;)

FWIW the actual answer is that libraries should be good at reporting / returning errors to the calling application in a reasonable manner instead of tripping assert()s or crashing the entire process. Which makes the question moot because ideally the library has few asserts to begin with.

Re:Two handy GDB breakpoint tricks by Peter0x44 on Monday January 29, 2024 @06:52AM (#39175262)
Asserts are to make your code more sensitive to defects, for example, checking function invariants. Ideally the library has more, not less, since they show care and thought has gone in. They should never be used to handle errors.

Another feature of asserts is that `-DNDEBUG` disables them.

Re:Two handy GDB breakpoint tricks by eqvinox on Monday January 29, 2024 @02:08PM (#39180887)
Sorry, yeah, I'm just living in a world where asserts being misused to "handle errors" is unfortunately rather common. My argument is specifically against that kind of assertion, I should've been more clear.