An error code is a 32-bit value, structured as: 0x8000CCEE. The CC section is an 8-bit error class, and the EE section is the 8-bit error value for that class. For example, all system generic error codes are of the form 0x800005EE, and the "out of memory" error is a part of the system error class with the number 0x80000503.
This definition means that all error codes are negative values, so you can multiplex an integer containing either a positive ssize_t non-error or an error code.
There are a standard set of generic error codes that are defined, which should be used wherever applicable instead of creating your own error code. For example, unlike in the past where there was a different out-of-memory error code for each error class, you should now return the generic sysErrNoFreeRAM instead of defining your own.
Files | |
file | CmnErrors.h |
Definition of all error classes and common error codes. |