home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / sysv386 / 16404 < prev    next >
Encoding:
Internet Message Format  |  1992-11-11  |  3.9 KB

  1. Xref: sparky comp.unix.sysv386:16404 biz.sco.opendesktop:729 biz.sco.general:4113
  2. Newsgroups: comp.unix.sysv386,biz.sco.opendesktop,biz.sco.general
  3. Path: sparky!uunet!caen!destroyer!mudos!mju
  4. From: mju@mudos.ann-arbor.mi.us (Marc Unangst)
  5. Subject: Re: Bug with ScoSession connecting to XTerm with >16 colors
  6. Message-ID: <BxL0DA.IFw@mudos.ann-arbor.mi.us>
  7. Date: Thu, 12 Nov 1992 02:31:50 GMT
  8. References: <1992Nov4.191635.4114@bnr.ca> <Bx863s.6oL@mudos.ann-arbor.mi.us> <1dqhh8INN7k9@escargot.xx.rmit.OZ.AU>
  9. Organization: The Programmer's Pit Stop, Ann Arbor MI
  10. Lines: 61
  11.  
  12. In article <1dqhh8INN7k9@escargot.xx.rmit.OZ.AU> s900387@minyos.xx.rmit.oz.au (Craig Macbride) writes:
  13. >A better solution would be for ANSI to realise that including C checks in
  14. >the pre-processor is a _bad_ idea, since the C preprocessor is widely
  15. >used as a general preprocessor. This is a classic instance of ANSI creating
  16. >a situation whereby its "standard" behaviour gives no advantage over the
  17. >old situation, but breaks heaps of existing applications.
  18.  
  19. The fact that the C preprocessor on Unix has accepted non-legal C code
  20. in the past is more or less a historical accident of the compiler
  21. design, and certainly not something that was designed-in as a feature.
  22. (This is, of course, speculation, but I suspect that it's correct.)
  23. The only reason that the C preprocessor doesn't barf on illegal C code
  24. is that it would be more work for it to do so, since the code is not
  25. actually parsed for compilation purposes until a later pass of the
  26. compiler.
  27.  
  28. However, the ANSI committee did not desire to make things more
  29. difficult for the compiler writers, and in addition wanted to give
  30. them as much flexibility as possible.  So, the ANSI specification says
  31. that the C preprocessor's behavior is "undefined" when it is not fed
  32. legal C code.  (A user-friendly compiler, of course, might either give
  33. you an error or try to forge on anyway, but the compiler is free to do
  34. whatever it pleases, including executing "/bin/rm -rf .".)  This
  35. allows a compiler writer to make a one-pass compiler that does
  36. preprocessing, code parsing, and assembler-code generation all in one
  37. step.  Now, if you had a compiler that behaved like this, exactly how
  38. do you go about feeding something to just the "preprocessor", and
  39. arranging to get your output before it makes it to the "code parser"?
  40. And what is the compiler supposed to do with something that isn't
  41. legal C code, when there are no separate preprocessor and code-parser
  42. passes?
  43.  
  44. Also keep in mind that ANSI was not writing a standard for Unix, even
  45. though you might think of Unix as the environment where most of the C
  46. code in the world gets written and compiled.  Does Borland's Turbo C++
  47. have a separate C preprocessor pass that you can feed arbitrary text
  48. to?  And get something other than error messages out of when you do?
  49. And why should they bother to include something like that, when
  50. they're selling a C compiler instead of a stream-editor?
  51.  
  52. I will reiterate: If you want a general-purpose text processor, then
  53. use one.  Don't try to cobble something together out of other
  54. (unsuitable) tools, and then complain when the resulting mess doesn't
  55. work the way you expect it to.
  56.  
  57. >Even if ANSI don't ever get their act together, the good folks at SCO
  58. >should at least realise that removing capabilities from their product
  59. >doesn't win them any friends and keep the old cpp available in some
  60. >form or other.
  61.  
  62. SCO doesn't write any of the C compilers they distribute.  Microsoft
  63. writes the compiler distributed as /bin/cc, and AT&T writes the
  64. compiler distributed as /bin/rcc.  I believe that in SVR3, the AT&T
  65. compiler was still K&R instead of ANSI, so if you can find the AT&T
  66. preprocessor you should be able to use that on arbitrary text.
  67.  
  68. -- 
  69. Marc Unangst, N8VRH         | "There are two ways to solve this problem:
  70. mju@mudos.ann-arbor.mi.us   | the hard way, and the easy way.  Let's start
  71.                             | with the hard way."
  72.                             |   - W. Scheider, from a Physics lecture
  73.