Preprocessor metaprogramming library for plain C

1.2k Views Asked by At

Does anybody know a library similar to boost::preprocessor (maybe not so advanced) that could be easily used/incorporated in plain C projects? Of course, the most (all ?) of boost::preprocessor is usable when writing in C but I would prefer a small library with only basic capabilities that doesn't depend on the monster like boost.

3

There are 3 best solutions below

0
On BEST ANSWER

I suggest you use Boost.Preprocessor. Don't think i haven't read your question entirely. I suggest you use Boost.Preprocessor alone, not the whole boost package. In order to do that, you can use a small utility called bcp which lets you extract the libraries that you need, in your case Boost.Preprocessor.

0
On

P99 (http://p99.gforge.inria.fr/) comes to mind.

Quote:

P99 is a suite of macro and function definitions that ease the programming in modern C, aka > C99. By using new tools from C99 we implement default arguments for functions, scope bound > resource management, transparent allocation and initialization, ...

0
On

You can always extract components out of boost using bcp, though, to be honest, i haven't tested that with Boost.Preprocessor yet.
I think you will have a hard time to find other implementations that are as portable as boosts.