home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!taumet!steve
- From: steve@taumet.com (Steve Clamage)
- Subject: Re: Questions about token merging and trigraphs
- Message-ID: <1992Dec18.162011.374@taumet.com>
- Organization: TauMetric Corporation
- References: <42098@pprg.eece.unm.edu.pprg.unm.edu> <1TA04E3@cdis-1.compu.com> <mcdonald.610@aries.scs.uiuc.edu> <2408@sdrc.COM>
- Date: Fri, 18 Dec 1992 16:20:11 GMT
- Lines: 26
-
- scjones@thor.sdrc.com (Larry Jones) writes:
-
- >> BECAUSE OF THEM, it is **IMPOSSIBLE** to write code that is both
- >> K&R I and ANSI!!!
-
- >Nonsense -- simply avoid using those combinations of characters. Since
- >you presumably have to continue to support your existing file format,
- >you can't follow that advice, but you can do something like:
-
- > const char delims[5][4] = {
- > { '?', '?', '!', '\0' }, ...
-
- Actually, it's easier than that.
-
- You can replace, for example, "??!" with "?\?!".
- The escaped second question mark breaks up the trigraph.
-
- This means you can write a simple filter (or editor script) which
- blindly replaces the trigraph sequences with versions as above.
- You can apply it to any code which was not intended to be compiled
- as having trigraphs. The result will work with both K&R and Standard
- compilers. (If you used a trigraph-like sequence in a comment, you
- would also get the escaped question mark there.)
- --
-
- Steve Clamage, TauMetric Corp, steve@taumet.com
-