Comparing reflection capabilities of C++, Zig and C3

nyr24 Sep 20, 2026 Comparing reflection capabilities of C++, Zig and C3
Reflection lets a program inspect and manipulate its own structure at runtime or compile time. All C++ (with its upcoming reflection support), Zig and C3 rely on compile-time reflection, so you can reason about types, enumerators, and struct members without any runtime cost. In this post I will compare how these languages approach compile-time reflection.
C3 is a relatively new programming language which mainly focuses on readability, performance, minimalism, and familiarity for C/C++ programmers. It doesn't have heavy runtime, garbage collection, exceptions or RAII. It also fully supports C ABI compatibility out of the box.
C3 uses special syntax for compile-time execution: all variables, control-flow constructs are prefixed with $ . This was done on purpose to explicitly show the reader which code runs at compile time. It uses macros for compile-time evaluation and reflection.
Get smarter about the news
Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.
Create free accountAlready have an account? Sign in