|
|
|
|
|
by enhray
1790 days ago
|
|
The C preprocessor is definitely ill-suited for metaprogramming, but it was never the C way, was it? The traditional way to do any kind of meaningful metaprogramming in C is just a printf() to a .h or .c file which then is included to your build. There are a lot of projects doing that. Bison is supposed to be used this way, other projects are doing build configuration like that - by emitting a header with a ton of #define’s, and there’s a ton of languages which use C as a compilation target - and you can see what they are doing and get inspiration from that. In my opinion it’s an extremely powerful model, much better than anything you can do with the preprocessor. |
|
[1]: https://github.com/Hirrolot/metalang99#q-why-not-third-party...