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

Maarten Litmaath maart at cs.vu.nl
Sat Sep 23 08:22:05 AEST 1989


ok at cs.mu.oz.au (Richard O'Keefe) writes:
\...     #if 0
\...     ...
\        #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?

\(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.  Quality of implementation?
That's another point for Sun, 'cause their cpp works. :-)

\    You're going to laugh, but how about using the Bourne shell as a
\condition processing facility?  E.g.
\	if [ ... ] ; then
\	    cat <<'EndOfPart'
\	any old text -- almost
\	EndOfPart
\	else
\	    # equivalent of 'include'
\	    cat foo.inc
\	fi

Great!  However, use `test' instead of `[' if portability is an issue. :-(
-- 
   creat(2) shouldn't have been create(2): |Maarten Litmaath @ VU Amsterdam:
      it shouldn't have existed at all.    |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.unix.wizards mailing list