|
CX Framework
Cross-platform C utility framework
|
Modules | |
| Variant Creation | |
| Variant Lifecycle | |
| Variant Type Checking and Access | |
| Variant List Walking | |
Type-tagged variant containers providing runtime polymorphism and type-safe variadic function arguments without exposing raw va_list semantics.
The stvar structure combines an stype descriptor with a typed value container (stgeneric), enabling a single variable to hold values of different types while preserving type information at runtime. This is the foundation for:
va_list with arrays of stvarVariants created with stvar() use C99 compound literals to create stack-allocated temporaries. These temporaries have automatic storage duration limited to the enclosing block scope:
For persistent variants, use explicit allocation or embed in structures:
Creating variants:
Type checking and access:
Variadic function pattern: