#ifdef considered harmful

Simon Marlow simonmar at microsoft.com
Wed Apr 7 14:45:29 EDT 2004


 
> At 08:57 07/04/04 +0100, Simon Peyton-Jones wrote:
> >cpp is readily available everywhere, whereas some new
> >tool would not be.
> 
> Hmmm... it was my perception of the falsity of this that led 
> me to raise 
> the issue in the first place.  See also [1].
> 
> Otherwise, I broadly agree with the points you make.

One good reason for implementing our own preprocessor that nobody has
raised yet is that the implementation of cpp we all use (gcc) is not
under our control and recently has been changing its semantics in ways
that affect us.  CPP in gcc 3.4 interprets '\' followed by whitespace at
the end of a line as a line continuation; previous versions of cpp
didn't do that, and it makes it impossible to use Haskell string gaps in
CPP'd Haskell source.  I don't trust the GCC guys to keep the
-traditional flag around for ever either.

I'd settle for just finding a good standalone open source cpp, removing
any undesirable features, and shipping it with the compilers.

BTW, Hugs copes with CPP directives in the standard libraries by running
CPP over the source code before packaging up the distribution: that way
CPP isn't required on the target system.

Cheers,
	Simon


More information about the Libraries mailing list