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

  1. Path: sparky!uunet!europa.asd.contel.com!howland.reston.ans.net!usc!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!olivea!charnel!sifon!thunder.mcrcim.mcgill.edu!mouse
  2. From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Questions about token merging and trigraphs
  5. Message-ID: <1992Dec20.232559.10625@thunder.mcrcim.mcgill.edu>
  6. Date: 20 Dec 92 23:25:59 GMT
  7. References: <1TA04E3@cdis-1.compu.com> <iJqwVB1w165w@quest.UUCP>
  8. Organization: McGill Research Centre for Intelligent Machines
  9. Lines: 73
  10.  
  11. In article <iJqwVB1w165w@quest.UUCP>, kdq@quest.UUCP (Kevin D. Quitt) writes:
  12. > tanner@cdis-1.compu.com (Dr. T. Andrews) writes:
  13. >>> What are trigraphs?
  14. >> Trigraphs are an unpleasant invention from the successor to the
  15. >> horse committee...
  16. > Perhaps Dr. Andrews should spend a little time in thought before
  17. > lashing out at necessary and occasionally useful, if obscure, parts
  18. > of C.
  19.  
  20. Necessary?  The problem they are intended to solve needs solving.  The
  21. solution does not have to be trigraphs.  Thus, I don't believe they are
  22. necessary.
  23.  
  24. Occasionally useful?  Certainly.
  25. Obscure?  Definitely.
  26. Occasionally dangerous?  That too.
  27.  
  28. > Trigraphs are the *only* way to represent certain critical characters
  29. > on machines that do not support the ASCII character set.
  30.  
  31. Not at all.  There are plenty of other ways of representing them, such
  32. as their canonical ISO Latin-1 names, which require only uppercase
  33. English alphabetics and a few other extremely common characters like
  34. hyphen and space.  Trigraphs are merely a reasonably compact and
  35. marginally readable representation that doesn't clash *too* badly with
  36. the rest of C.
  37.  
  38. There is, however, no necessity whatever for them to have been made
  39. part of the standard.  All that was really needed was a note that in
  40. environments where the necessary characters are not all available, some
  41. encoding of the missing ones will be necessary, and a specification
  42. that any such encoding takes place before any other processing (as
  43. current trigraphs do), perhaps with a recommended encoding for
  44. environments where the invariant character set is available.  The
  45. specification of an interchange format - perhaps the current trigraph
  46. coding - would also have been a good idea.
  47.  
  48. That's all that was really needed.  Every specification like this has a
  49. "native" character set, which it is most at home in: in this case,
  50. history forced this to be ASCII (less a couple of characters, like @).
  51. All environments without this set avaiable must use kludges of various
  52. degrees of unpleasantness.  There is absolutely no excuse for forcing
  53. people using the native environment to see the kludges used by others.
  54.  
  55. In my opinion, a compiler with no way to disable trigraph processing is
  56. simply broken, and a compiler that enables them by default is
  57. defective.  Unless, of course, it is running in an environment where
  58. the trigraphed characters do not exist.
  59.  
  60. > The cost of something unexpected in an error string is a fairly small
  61. > price to pay for allowing non-ASCII machines to support portable C
  62. > code; after all, *code* isn't going to break.
  63.  
  64. Yeah, right.  As if double-quoted strings weren't part of code.
  65.  
  66. My own contribution to the list of possibly-broken code, and yes, I
  67. *know* there are plenty of workarounds:
  68.  
  69. /* Control values for the ALU emulator */
  70. /* these are the values fed to the ALU control lines */
  71. /* values not defined require use of the C and D inputs,
  72.    which this emulator does not provide. */
  73. #define OP_NOT 3
  74. #define OP_AND 7
  75. #define OP_OR 9
  76. #define OP_NEG 11
  77. #define OP_NOP 15
  78. char opletters[] = "???!???&?|?-???+";
  79.  
  80.                     der Mouse
  81.  
  82.                 mouse@larry.mcrcim.mcgill.edu
  83.