tech-toolchain archive

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

Re: traditional cpp



David Holland wrote:-

> But if you drop comments on directive lines *before* expansion to make
> this problem go away, the /**/ comments used for token pasting
> disappear and nothing works.
> 
> I'm now really curious what a genuine legacy cpp really does. Maybe it
> does two comment-stripping passes, one handling multiline comments
> before interpreting directives and one handling same-line comments
> afterwards? I wonder what
> 
>    /* blah
>    */#define FOO foo
>    FOO
> 
> vs.
> 
>    /**/#define FOO foo
> 
> vs.
> 
>    /* blah */#define FOO foo
> 
> generates.

None are directives; trad cpp requires # in the first column.

trad cpp removes block comments before scanning for macros and expanding
them.

FWIW I wrote GCC's current support of trad cpp in 2002 after we
integrated it in cc1.  It's as faithful as you can reasonably be
to something pre-standard.

Neil.


Home | Main Index | Thread Index | Old Index