home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sdrc!thor!scjones
- From: scjones@thor.sdrc.com (Larry Jones)
- Newsgroups: comp.lang.c
- Subject: Re: Questions about token merging and trigraphs
- Message-ID: <2408@sdrc.COM>
- Date: 17 Dec 92 16:31:14 GMT
- References: <42098@pprg.eece.unm.edu.pprg.unm.edu> <1TA04E3@cdis-1.compu.com> <mcdonald.610@aries.scs.uiuc.edu>
- Sender: news@sdrc.COM
- Lines: 43
-
- In article <mcdonald.610@aries.scs.uiuc.edu>, mcdonald@aries.scs.uiuc.edu (J. D. McDonald) writes:
- > [ re trigraphs ]
- > That last it **UTTERLY WRONG**. I found that **many** of my programs
- > broke!! **MANY** .. and they had lots of occurences of ??!,
- > ??) ??(, ??[. and ??] in them, in **critical** places!!!
- >
- > I chose them as delimiters in a special ASCII file format for data,
- > and chose them as no one would be likely to try to use them as
- > actual strings in the text-comment portion of the file!! They are coded
- > into the program in strings .. and it would not have been so bad had
- > not the idiotic ANSI committee decided that they would be replaced in
- > strings as well as code!!
-
- If they weren't replaced in strings, they wouldn't be much good. I
- sympathize with your problems, but ANSI C compilers have been around for
- a long time now and you are the first person I've heard complain about
- trigraphs causing major breakage.
-
- > 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' },
- { '?', '?', ')', '\0' },
- { '?', '?', '(', '\0' },
- { '?', '?', ']', '\0' },
- { '?', '?', '[', '\0' }};
-
- and then use delims[] rather than having explicit strings in the code.
-
- > Ordinary C was never broken in this regard, so no fix was necessary.
- > Trigraphs should be removed from the standard, TODAY.
-
- Can you spell "parochial"? You've obviously never tried to use C on an
- IBM mainframe or a computer in Japan, Denmark, etc.
- ----
- Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH 45150-2789 513-576-2070
- larry.jones@sdrc.com or ...uunet!sdrc!larry.jones
- I can feel my brain beginning to atrophy already. -- Calvin
-