home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18576 < prev    next >
Encoding:
Internet Message Format  |  1992-12-20  |  2.2 KB

  1. Path: sparky!uunet!sdrc!thor!scjones
  2. From: scjones@thor.sdrc.com (Larry Jones)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Questions about token merging and trigraphs
  5. Message-ID: <2408@sdrc.COM>
  6. Date: 17 Dec 92 16:31:14 GMT
  7. References: <42098@pprg.eece.unm.edu.pprg.unm.edu> <1TA04E3@cdis-1.compu.com> <mcdonald.610@aries.scs.uiuc.edu>
  8. Sender: news@sdrc.COM
  9. Lines: 43
  10.  
  11. In article <mcdonald.610@aries.scs.uiuc.edu>, mcdonald@aries.scs.uiuc.edu (J. D. McDonald) writes:
  12. > [ re trigraphs ]
  13. > That last it **UTTERLY WRONG**. I found that **many** of my programs
  14. > broke!! **MANY** .. and they had lots of occurences of ??!, 
  15. > ??) ??(, ??[. and ??] in them, in **critical** places!!!
  16. > I chose them as delimiters in a special ASCII file format for data,
  17. > and chose them as no one would be likely to try to use them as
  18. > actual strings in the text-comment portion of the file!! They are coded
  19. > into the program in strings .. and it would not have been so bad had
  20. > not the idiotic ANSI committee decided that they would be replaced in
  21. > strings as well as code!!
  22.  
  23. If they weren't replaced in strings, they wouldn't be much good.  I
  24. sympathize with your problems, but ANSI C compilers have been around for
  25. a long time now and you are the first person I've heard complain about
  26. trigraphs causing major breakage.
  27.  
  28. > BECAUSE OF THEM, it is **IMPOSSIBLE** to write code that is both
  29. > K&R I and ANSI!!!
  30.  
  31. Nonsense -- simply avoid using those combinations of characters.  Since
  32. you presumably have to continue to support your existing file format,
  33. you can't follow that advice, but you can do something like:
  34.  
  35.     const char delims[5][4] = {
  36.         { '?', '?', '!', '\0' },
  37.         { '?', '?', ')', '\0' },
  38.         { '?', '?', '(', '\0' },
  39.         { '?', '?', ']', '\0' },
  40.         { '?', '?', '[', '\0' }};
  41.  
  42. and then use delims[] rather than having explicit strings in the code.
  43.  
  44. > Ordinary C was never broken in this regard, so no fix was necessary.
  45. > Trigraphs should be removed from the standard, TODAY.
  46.  
  47. Can you spell "parochial"?  You've obviously never tried to use C on an
  48. IBM mainframe or a computer in Japan, Denmark, etc.
  49. ----
  50. Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
  51. larry.jones@sdrc.com  or  ...uunet!sdrc!larry.jones
  52. I can feel my brain beginning to atrophy already. -- Calvin
  53.