r/C_Programming • u/heavymetalmixer • Jun 11 '26
Question C ways to manage errors?
I'm still learning C (I come from C++) and I'm not familiar with how to manage errors in C, besides asserts. What are the different ways to do this in C? How do they work?What are their pros and cons?
35
Upvotes
View all comments
Show parent comment
2
u/Crtusr Jul 02 '26
NASA's Power of ten puts a limit on the amount of asserts Inside functions (I believe one or two), but as many have said, it is for things that should never happen, that means, you are assuming there is a bug in your logic (that is not UB, because it can bypass assertion).