gpp (conditional compilation)

dustin at v.igoro.us dustin at v.igoro.us
Wed May 2 13:45:21 EDT 2007


On Wed, May 02, 2007 at 10:37:40AM -0700, maxwell at ldc.upenn.edu wrote:
> I'm trying to use the gpp utility (Gnu points to http://en.nothingisreal.com/wiki/GPP)
> to do conditional compilation in Python, and I'm running into a
> problem: the same '#' character introduces Python comments and is used
> by default to introduce #ifdef etc. lines.

The hacks you'll need to wrap gpp in to get it to work will make your
head spin.

I'm not sure what brought you to gpp, but if you're looking for a basic
macro-processing language suitable for the kinds of tasks the C
preprocessor performs, I would recommend M4.  GNU has an implementation
of the language, and it's actually quite widely used as the basis for
the GNU autotools suite.  It is incredibly flexible (enough so that its
learning curve is a bit steep, but not too bad), but that flexibility
enables it to work with just about any underlying language.

Dustin



More information about the Python-list mailing list