home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19243 < prev    next >
Encoding:
Internet Message Format  |  1993-01-05  |  3.3 KB

  1. Path: sparky!uunet!pipex!bnr.co.uk!uknet!pavo.csi.cam.ac.uk!ag129
  2. From: ag129@cus.cam.ac.uk (Alasdair Grant)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Questions about token merging and trigraphs
  5. Message-ID: <1993Jan5.130133.16398@infodev.cam.ac.uk>
  6. Date: 5 Jan 93 13:01:33 GMT
  7. References: <1992Dec19.4396.29938@dosgate> <1992Dec21.172815.18921@thunder.mcrcim.mcgill.edu>
  8. Sender: news@infodev.cam.ac.uk (USENET news)
  9. Organization: U of Cambridge, England
  10. Lines: 50
  11. Nntp-Posting-Host: bootes.cus.cam.ac.uk
  12.  
  13. In article <1992Dec21.172815.18921@thunder.mcrcim.mcgill.edu> mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes:
  14. >In spite of the (apparent) fact that *nobody* uses them?  I have yet to
  15. >see even *one* posting, even from .nl or .be or anywhere else that one
  16. >might expect to see trigraphs in use, that actually supports them.  No,
  17. >I still stand by my position that trigraphs are a stupid and
  18. >unsuccessful attempt to solve a nevertheless very real problem.
  19.  
  20. I use them all the time.  As some people have already pointed out,
  21. the problem is not so much local (although it is true that my keyboard
  22. lacks square brackets and circumflex) but global.  For some character
  23. sets there are no universally accepted rules for translating into ASCII;
  24. this means that different compilers can behave in different ways.
  25. For example, one compiler on my machine reads the character X'5F' as
  26. the exclusive-OR operator; another reads it as the ones-complement
  27. operator.  (It is the character known as "NOT sign", which usually
  28. maps on to ASCII circumflex, but since we have a local code for that,
  29. we map NOT on to ASCII tilde.)
  30.  
  31. Another one is vertical bar; many character (including ISO Latin 1) have
  32. both solid and broken varieties.  Imagine someone who had followed K&R2
  33. and used broken bar, only to discover that their compiler writer had
  34. followed the C standard (ANSI printing, at least) and used the solid bar!
  35. Yet the ANSI standard is sufficiently informal that both compilers are
  36. standard-conforming.  (Unless you interpret the standard to say that all
  37. C source code must appear in 10-point Courier bold, as it does in the
  38. standard.  Seriously, I wouldn't want to deny Braille users a conforming
  39. C compiler.)
  40.  
  41. I sympathise with people who are worried about lexer overheads, though
  42. any compiler writer is at liberty to implement a #pragma notrigraphs.
  43. It's too late for a #pragma trigraphs since there are enough compilers
  44. around who will accept trigraphs anyway. The point about making trigraphs
  45. part of the standard is so that I can not only ship my source code to
  46. other similar systems, I can also run it under gcc on Unix and Microsoft
  47. C on my PC as well.
  48.  
  49. All examples of code breakage I have seen are bad style to start with;
  50. e.g. I'd write der Mouse's example of "?+??=??/" etc. as
  51.   "?"      /* 0: reserved */
  52.   "+"      /* 1: */
  53. etc. using ANSI string concatenation. I'd put large pieces of text into
  54. a help file or message repository. I'd read "tags" from a config. file.
  55. (Not that I have much confidence in "tags" anyway - the program that
  56. somebody had that used the string "??(" as a marker in files might have
  57. problems when faced with ANSI C source code, or indeed with all the old
  58. K&R source code that we are assured also contains "??(".)
  59.  
  60. So hooray for trigraphs.  And hooray for vendors like Microsoft who
  61. support them without making a fuss or putting snide comments in their
  62. documentation.
  63.