Alex Rivera | Logout

Replacements for the C preprocessor

Asked 2008-12-28T20:32:10.203
45

I'm interested in using something other than the C preprocessor to preprocess my C and Objective-C source code. Are there good alternatives?

An example would be something that allowed one to escape out into a python or perl snippet in the middle of C code, and where the snippet spit out C that is then compiled as normal.

Edit
Report

1 Answer

5

If you abstract your problem a bit, then you are in fact looking for a templating engine for your code. Just as most websites inserts dynamically generated content in static templates, you want to insert dynamically generated code into your program.

I currently use Jinja2 (Python) for most templating work - I've found it to be very configurable in every way.

answered 2009-07-28T16:50:06.067

Your Answer