Are there any standards for error code handling? What I mean by this is not how a particular error event is handled but what is actually returned in the process. An example of this would be when an error in opening a file is identified. While the open() function may return its own value, the function that called the open() function may return a different value.
Are there any standards for error code handling? What I mean by this is
Share
I don’t think ther’s a standard, all errors must be detected and handled (the caller should always handle errors).
in Unix in general:
the standard C library for exemple always
return -1 on failand set the global variable errno to the correct value.Some libraries for example
return NULLfor inexistant field rather than aborting.You should always return as much useful information as possible.
Hope this help.
Regards.