[comp.windows.x] Cpp

jf@ap.co.umist.ac.uk (John Forrest) (07/19/90)

We are running OS10.1 on some Apollo's. When we built R4 the first time
(pre-patches), we has some problems with the cpp program. The main problem
was that the Apollo cpp compiler will not translate the following:

#define x (y/\
	z)

as equivalent to:

#define x (y/z)

This sort of code is (was?) quite common in the sources. My first idea was
to translate each occurence to:

#define x (y/ \
	z)

which worked, but since this involved many changes etc, I derived a
second method where we use the public domain cpp program supplied in
util. I'm not sure if it made a difference that we try, as much as
possible, to use ANSI/C constructs with our compiler, although there are
some that Apollo do not support - for example it supports function
prototyping, but not "const" - so we compiler with "-Dconst=" !
Anyway, this works fine, except that the cpp program is a bit slow, and
often takes far longer to execute than the compiler proper. I have tried
the gcc preprocessor, but this did not work with the Apollo cc compiler.
Before anyone suggests we just use gcc instead of cc, the usual stuff
about gcc producing far better code than cc might be true for Sun's but
it is not (in our experience) true for Apollo's. Indeed there some
things we need the Apollo compiler for - for example shared libraries.
Has anyone had similar problems or derived other solutions?

John Forrest
Dept of Computation
UMIST.