|
CX Framework
Cross-platform C utility framework
|
Enumerations | |
| enum | CX_ERROR { CX_Success = 0 , CX_Unspecified , CX_InvalidArgument , CX_AccessDenied , CX_FileNotFound , CX_AlreadyExists , CX_IsDirectory , CX_ReadOnly , CX_Range , CX_NotSupported } |
Functions | |
| const char * | cxErrMsg (int err) |
Variables | |
| _Thread_local int | cxerr |
Thread-local error code system for functions that cannot return error values.
The cxerr facility provides a thread-safe error reporting mechanism similar to the standard errno, but integrated into the CX framework. Functions that need to report errors but cannot return an error code (e.g., functions returning pointers or having other return value semantics) can set cxerr to indicate the reason for failure.
Key characteristics:
CX_Success) indicates successTypical usage pattern:
Functions should document when they set cxerr on failure.
| enum CX_ERROR |
Standard CX error codes
Error codes used throughout the CX framework. Functions set cxerr to one of these values to indicate specific error conditions.
| Enumerator | |
|---|---|
| CX_Success | Operation completed successfully (no error) |
| CX_Unspecified | Unknown or unspecified error occurred. |
| CX_InvalidArgument | Function argument is invalid or malformed. |
| CX_AccessDenied | Permission denied or access not allowed. |
| CX_FileNotFound | Requested file or resource does not exist. |
| CX_AlreadyExists | File or resource already exists; refusing to overwrite. |
| CX_IsDirectory | Attempted to treat a directory as a file. |
| CX_ReadOnly | Attempted to write to read-only path or resource. |
| CX_Range | Value is out of valid range. |
| CX_NotSupported | Operation is not supported on this platform. |
| const char * cxErrMsg | ( | int | err | ) |
Get human-readable error message for an error code
| err | Error code from CX_ERROR enum |
Returns a descriptive message for the given error code. Useful for logging or displaying error information to users.
|
extern |
Thread-local error code
Set by functions to indicate error conditions. Check this variable after calling functions that document cxerr usage. Always CX_Success (0) when no error occurred.