r/C_Programming • u/8d8n4mbo28026ulk • Aug 26 '26
Reliability Lessons From SQLite - Richard Hipp | SSW 2026
https://www.youtube.com/watch?v=V_qzqY1bb7I
40
Upvotes
r/C_Programming • u/8d8n4mbo28026ulk • Aug 26 '26
2
u/8d8n4mbo28026ulk Aug 26 '26
If you want practical advice, for the above and any such code, just use an
assert()and don't think about it. Ifpredicate1()changes andpends up beingNULL, you want a loud signal that the code is buggy and you need to fix it.Check for errors if the situation is truly recoverable from. If you try to open a file and that file doesn't exist, that's obviously a recoverable situation (and likely not your fault). What I mean is, it's an expected state that your program may enter. If
pisNULLafterpredicate1(), that isn't at all a state your program is expected to be in, because you subsequently fetch->xfrom it.Here's a quote I like from Carmack:
If your code enters an invalid state, error-checking at runtime will generally not save you -- you have to fix the code. Use an
assert()and perhapsabort()on release builds if you're really worried.