tech-toolchain archive

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

Re: traditional cpp



> [4.3BSD's cpp] fireworks rather badly when I try to build it; I'll be
> trying to coax it into building.  If I succeed I'll thrown these
> tests at it.

Okay, I make typos. :-/

But I managed to persuade it to build.  Here are some examples, taken
from this thread.  Every line, input or output, gets a tab-|-space
prefix, to make blank lines obvious.  If you care about trailing
whitespace, negotiate with your mailreader about making it visible;
it's present on at least one or two lines.

        | #define STOP */
        | #define START /*
        | /* hello there STOP fnord START ho hum */
->
        | # 1 ""
        | 
        | 
        | 

(I'm feeding these to cpp as stdin, not via a filename on the command
line, hence the "" filename.)

        | #define K(x) "x"
        | K(123)
->
        | # 1 ""
        | 
        |  "123"
(As expected; Reiser does macro argument replacement - not macro
expansion, note - inside string literals.)

        | #define A    a // blah
        | #define B    b
        | A B
->
        | # 1 ""
        | 
        | 
        |    a // blah    b
(No surprise; C++-style // comments are much newer than Reiser cpps.)

        | #define FOO foo /*
        | #undef FOO
        | #define FOO bar */
        | FOO
->
        | # 1 ""
        | 
        | 
        | 
        | foo 
(It appears to consider the /*\n...\n...*/ a single comment.)

        | /* blah
        | */#define FOO foo
        | FOO
->
        | # 1 ""
        | 
        | #define FOO foo
        | FOO
(No surprise to me at least; # is recognized only when it's the real
first character on a line.)

        | /* blah */#define FOO foo
        | FOO
->
        | # 1 ""
        | #define FOO foo
        | FOO
(Similar remarks apply.)

        | /**/#define FOO foo
        | FOO
->
        | # 1 ""
        | #define FOO foo
        | FOO
(And again.)

                                        Mouse


Home | Main Index | Thread Index | Old Index