[Gllug] Website developement

Nix nix at esperi.demon.co.uk
Sun Jul 15 12:52:30 UTC 2001


On Sat, 14 Jul 2001, David Freeman uttered the following:
>  --- Stig Brautaset <stig at brautaset.org> wrote: > David Freeman
> <freemadi at yahoo.co.uk> writes:
>> for on my webpage.  I use gcc's preprocessor to merge a template

Oh, no...

>> holding the layout and link bit, and a file for holding the actual
>> Have a look at http://www.brautaset.org/config.htm to get an idea. 
>> Feel free to email me with questions.
> 
> You are a genius! I wish I had thought of it, and I had spent so long
> peeing about with the preprocessor all day as well! 
> 
> If we ever meet I owe you a pint!
> 
> gcc and make solve yet another problem!

This is one that they are not supposed to solve. The C preprocessor can
only sensibly handle C; any attempt to make it handle anything else
(like Makefiles, hello imake, or X resources files) is a mistake.

You will find oddities happening, like the string `i586' collapsing to
`1' in the expanded page; it Just Won't Work like you want it to.

(In fact, as of GCC-3.0, it won't work at all; `cpp -traditional' will
work better than nothing --- that was kept working for the sake of
imake.)

Consider that transformation of a source file into tokens happens
*before* preprocessing; the preprocessor operates on a stream of C
tokens, *not* on text.

If you want a generalized macro expander, use M4. It has many, many
advantages over cpp for this sort of thing; cpp should not even be
considered for it.

Using make is fine. Using cpp is a horrible mistake.

-- 
`I'm not sure whether libtool is an existence proof that you _can_
 write a shell script that handles its arguments correctly, or a
 demonstration that you may try but you are doomed to failure.'
                                                       -- Zack Weinberg


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list