alt.hn

5/28/2026 at 2:55:22 PM

Adding Reflection to C

https://www.davidpriver.com/adding-reflection-to-C.html

by telotortium

5/28/2026 at 9:51:54 PM

BTF or DWARF info in principle contain the information needed, though working with them is cumbersome...

by cozzyd

5/28/2026 at 6:48:20 PM

Been there… Pendantic nitpick: it's more akin to introspection, reflection would be self-modifying code.

by tliltocatl

5/29/2026 at 4:36:09 AM

Nice. But you've just invented Zig!

by teo_zero

5/29/2026 at 5:02:23 PM

C with Zig's comptime is compelling though. Zig doesnt allow you to access all the features your C compiler does, and puts you in the LLVM ecosystem. I've been working on something similar; extending C with both Zig/C++ inspired reflection and linear types, with a compiler that compiles to a subset of C to allow you to leverage GCC and all its extenstions.

by accelbred