I have my own return type and functions defined like this:
typedef enum xx_return_t {
success = 0,
general_error = -1,
specific_error = -2,
[...]
} xx_return_type;
xx_return_type generalFunction(void) {
if(there_was_an_error)
return general_error;
}
However I'm a bit uncertain on the error type values here; what is standard/best practice for values of error returns in C/C++ - negative or positive?
Update: Thank you for your answers! I was looking for info on both C and C++, but I also realize this raises good questions on general structure and methods specific to each language (exceptions, error codes, object returns, etc).