API Reference — status/StatusCode
StatusCode
Represents the outcome of an operation as a numeric code paired with a human-readable message.
Why this exists
StatusCode exists so that operations across module boundaries (including C API boundaries where exceptions cannot cross) can report success or failure without relying on exceptions. Pairing an integer code with a message lets callers branch on the code while still surfacing a readable description for logging or diagnostics.
Fields
| Name | Type | Description |
|---|---|---|
code |
int |
required — numeric status/error code; 0 conventionally indicates success, non-zero indicates a specific failure condition |
message |
const char* |
required — human-readable description of the status, typically for logging or diagnostics |
Relationships
operator==/operator!=— compare twoStatusCodevalues by theircodefield only (message is ignored for equality)
Constraints
- Equality is code-only. Two
StatusCodevalues with the samecodebut differentmessagestrings are considered equal byoperator==. Do not usemessagecontent as an identity signal.
Watch out for
messageis a rawconst char*with no ownership. Pointing it at a temporarystd::string::c_str()or a local buffer produces a dangling pointer. Always use a string literal or a heap allocation whose lifetime exceeds theStatusCode.