tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: traditional cpp



On Mon, Dec 20, 2010 at 10:52:48AM +0000, David Holland wrote:
> How's it
> supposed to be done? Right now it's removing comments after macro
> expansion, but if it removes comments before macro expansion then /**/
> doesn't work for pasting... or else it has to be treated specially and
> stripped out again afterwards?

I think the /*...*/ is treated as a single token.
So foo/*...*/bar is initially 3 tokens, the foo and bar might both
be expanded but get written to the output without an intervening space.
Actually it might then need reprocessing for further expansion
(generally I think that is the way nested expansions are done).

Did the original cpp put spaces between output token? or was that
added later to avoid problems with foo = -bar when bar is -1 (or even
with foo=bar when bar is -1).

Passing comments through to the output also requires that // comments
get converted to /*...*/ ones - otherwise continuation lines cause grief.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index