C++HFTOpen Source

Title

Dodo

C++ LibrarySingle-header C++20 failure-handling framework for low-latency, deterministic, and reliable systems.

Description

Dodo is a header-only C++20 framework for explicit failure handling on latency- and reliability-critical systems, avoiding exceptions, allocation, RTTI, locks, and I/O.

Hot Path (Success)

~6.8–8.7 cycles (TSC, O3)

Cold Path (Failure)

~14.5–23.4 cycles (TSC, O3)

Developed Description

Dodo addresses a common constraint in real-time and low-latency systems: failures must be handled explicitly without the unpredictability of exceptions, heap allocation, RTTI, locks, or I/O. The framework enforces a two-path design: the hot path keeps success checks inlined with branch prediction hints, while the cold path constructs a minimal Failure object only when a check fails, routing recoverable failures to a fallback handler and fatal invariants to a panic handler that traps. This keeps the normal flow fast and deterministic while still preserving contextual diagnostics when needed. At the API level, Dodo standardizes behavior through macros like DODO_REQUIRE, DODO_ENSURE, DODO_INVARIANT, and various check helpers, ensuring call-site context is captured without overhead when checks pass. It separates recoverable input/data issues from fatal logic violations and provides a compact Status return type for propagation through call stacks. The system is designed for boundary handling: leaf functions return Status, and boundary layers (network ingress, order-entry gates, ISR boundaries) decide how to react, making it well suited to HFT, embedded drivers, and safety-critical software. A fast-mode option can strip diagnostic strings to reduce binary size and retain only codes and control flow, further supporting extreme production constraints.