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

  1. Path: sparky!uunet!spool.mu.edu!sdd.hp.com!cs.utexas.edu!usc!srhqla!quest!kdq
  2. From: kdq@quest.UUCP (Kevin D. Quitt)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Questions about token merging and trigraphs
  5. Message-ID: <XZo2VB1w165w@quest.UUCP>
  6. Date: Sat, 19 Dec 92 11:51:08 PST
  7. References: <1TA04FH@cdis-1.compu.com>
  8. Reply-To: srhqla!quest!kdq
  9. Organization: Job quest  (805) 251-8210,  So Cal: (800) 400-8210
  10. Lines: 118
  11.  
  12. tanner@cdis-1.compu.com (Dr. T. Andrews) writes:
  13.  
  14. > Underneath a bogus ``reply-to'' header, kdq@quest.UUCP writes..
  15.  
  16.     My reply-to line goes out of this site as "srhqla!quest!kdq"; if
  17. another site is munging that, there's little I can do.
  18.  
  19. > First, necessity: a trivial proof exists that there is no machine
  20. > on which the characters can not be represented in some other way.
  21.  
  22.     The necessity is to provide a *single* representation that is
  23. accpeted on *all* machines.  Certainly, one could map the APL character
  24. set onto ASCII, and program that way; the fact that something can be
  25. done does not make it useful or meaningful.
  26.  
  27.  
  28. > Second, utility: the most commonly-cited character set for  which
  29. > trigraphs are ``justified'', EBCDIC, certainly has the characters
  30. > in question.  Disagreement on  print-train  convention  may  mean
  31. > that  some  people  see  different  characters  in place of their
  32. > expected, on some of their printers.  A  similar  problem  exists
  33. > for  people  whose  terminals  replace  certain  ASCII characters
  34. > according to local preference.
  35.  
  36.     From the rationale:
  37.  
  38. "C derived its repetoire from the ASCII codeset.  Unfortunately the
  39. ASCII repetoire is not a subset of all other commonly used character
  40. sets, and widespread practice in Europe is not to implement all of
  41. ASCII either, but use some parts of its collating sequence for special
  42. national characters.
  43.  
  44. "The solution is an internationally agreed-upon repetoire, in terms of
  45. which an international representation of C can be defined.  The ISO has
  46. defined such a standard: ISO 646 describes an _invariant subset_ of
  47. ASCII. 
  48.  
  49. "The characters in the ASCII repetoire used by C and absent from the
  50. ISO 646 repetoire are: # [ ] { } \ | ~ ^  <<hash mark, left and right
  51. bracket, left and right brace, back-slash, vertical bar, tilde and
  52. caret>>.
  53.  
  54. "...The obvious idea of defining two-character escape sequences fails
  55. because C uses all the characters which _are_ in the ISO 646 repetoire:
  56. no single escape character is available.  The best that can be done is
  57. to use a _trigraph_ - an escape digraph followed by a distinguishing
  58. character."
  59.  
  60.  
  61. > This means that, without trigraphs, some  people  would  have  to
  62. > accept  what  their printers give; others would have to configure
  63. > terminals to show the ASCII characters when writing C.  It is not
  64. > clear that trigraphs are preferable.
  65.  
  66.     This means that some people would have alphabetic characters in
  67. place of those glyphs.  How'd you like to have code that looked like:
  68.  
  69. for L i=0; i<max; i++ M J
  70.    aNiO = i;
  71. K
  72.  
  73.  
  74. > Had the utility been clear, there would have been a large body of
  75. > prior  art  from  which  to  draw.  The lack of such a large body
  76. > suggests that the problem is insufficiently bothersome to justify
  77. > the development of the art.
  78.  
  79.     Either that, or those other systems had to put up with the ugliness
  80. above, or they couldn't run C, or programs written on them couldn't be
  81. ported to other unlike systems.
  82.  
  83.  
  84. > Third, harm: it is by no means  unlikely  that  ``can't  happen''
  85. > error  messages  may  include  text such as ``zero quark-count??!
  86. > contact support''.  The harm of having the error message  mangled
  87. > is small, but the benefit of this replacement in a string appears
  88. > to be zero.  If you have to use a trigraph for the character,  it
  89. > seems unlikely that you will benefit by putting it in a string.
  90.  
  91. "?? was selected as the escape digraph because it is not used anywhere
  92. else in C (except as noted below); it suggests that something unusual
  93. is going on.  The third character was chosen with an eye to graphical
  94. similarity to the character being represented.
  95.  
  96. "The sequence ?? cannot currently occur anywhere in a legal C program
  97. except in strings, character constants, comments, or header names.  The
  98. escape character sequence '\?' ...was introduced to allow two adjacent
  99. question-marks in such contexts to be represented as ?\?, a form
  100. distinct from the trigraph."
  101.  
  102.  
  103.  
  104. > Reduced program legibility is also harmful.
  105.  
  106. "The committee makes no claims that a program written using trigraphs
  107. looks attractive.  AS a matter of style, it may be wise to surround
  108. trigraphs with whitespace, so they stand out better in program text.
  109. Some users may wish to use preprocessing macros for some or all of the
  110. trigraph sequences".
  111.  
  112.  
  113. > Thus, because trigraphs are unnecessary,  insufficiently  useful,
  114. > and  occasionally harmful, I judge that they were an invention of
  115. > questionable virtue.
  116.  
  117.     I believe I've shown that your first adjective is incorrect, and
  118. your second is questionable.  As to harm, no code was broken; the only
  119. thing that changed was the appearance of some output - and you've
  120. yourself indicated that is of no great harm.
  121.  
  122.     After all, if some port of C is willing to use alphabetics that
  123. correspond to the ASCII codes for the 9 glyphs, they're free to do so.
  124. It's just that it's possible now, as it was not before, to write C code
  125. that is guaranteed to work on all implementations.
  126.  
  127.  
  128.  _
  129. Kevin D. Quitt      96.37% of all statistics are made up.     srhqla!quest!kdq
  130.