Needful: Rust-grade type checking for C, at zero runtime cost

(needful.metaeducation.com)

3 points | by ae1020 5 hours ago ago

1 comments

  • ae1020 5 hours ago ago

    Trick is that a single header of no-op macros (~600 lines of C, plus as many lines of comments) is committed into your project. Then if you want those macros to actually validate things at compile-time, you do a build with some extra C++ files that #undef's and re-#define's those macros with industrial-strength C++ metaprogramming.

    (It's basically high powered static analysis using the compiler you already have on your machine.)