There are many schemes - but no matter what you do, do it sequentially!
If you don't have many bad conditions, just use 0 for the error. This is because error tests are written in a simple way:
if (!list_insert(...)) { handle_error; }
Otherwise, answers below zero are useful for use with normal answers> = 0. You can use this for functions such as list length, which under normal conditions will not be negative. Or, if you need a lot of error codes (-1 - nonexentting, -2 - not found, -3 ..., ...)
source share