Need help using /usr/lib/cpp for generic text

Henry Spencer henry at utzoo.uucp
Sun Sep 24 07:53:25 AEST 1989


In article <3346 at solo12.cs.vu.nl> maart at cs.vu.nl (Maarten Litmaath) writes:
>\        #endif 0
>\(a)            ^ this token is not legal in dpANS C; V.3 tends not to like it
>
>What!?  The rest of the line isn't ignored?  And what was the very good reason
>the ANSI committee decided so?

Because only a few compilers ignored it, and the rest didn't, and there didn't
seem to be any good reason to perpetuate this irregular accident of certain
implementations.  Try `#endif /* 0 */' if you want to put a comment in.

>\(b) You should not use this technique to comment out text in a C program; new
>\C compilers are allowed to complain about mismatched quotes when they see
>\"don't" and other such text, and some _do_.
>
>I remember the discussion, but I don't recall the very good reason (here we
>go again) why those compilers could complain...

A good many compilers tokenize text before doing anything else with it, even
preprocessing.  To avoid rendering all those implementations illegal, it has
to be possible to do this.  The preprocessor was never specified clearly
enough to say that these implementations are wrong.
-- 
"Where is D.D. Harriman now,   |     Henry Spencer at U of Toronto Zoology
when we really *need* him?"    | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.unix.wizards mailing list