home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / system / 10214 < prev    next >
Encoding:
Text File  |  1992-07-21  |  3.6 KB  |  72 lines

  1. Newsgroups: comp.sys.mac.system
  2. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!sunb10.cs.uiuc.edu!sparc1.cs.uiuc.edu!pjl
  3. From: pjl@sparc1.cs.uiuc.edu (Paul Lucas)
  4. Subject: Re: Windows NT (Not a flame.) and C++ comments
  5. Message-ID: <1992Jul21.234417.13693@sunb10.cs.uiuc.edu>
  6. Sender: news@sunb10.cs.uiuc.edu
  7. Organization: University of Illinois at Urbana-Champaign
  8. References: <1992Jul21.124631.8584@msc.cornell.edu> <1992Jul21.192200.18180@tamsun.tamu.edu>
  9. Distribution: usa
  10. Date: Tue, 21 Jul 1992 23:44:17 GMT
  11. Lines: 59
  12.  
  13. In <1992Jul21.192200.18180@tamsun.tamu.edu> bpb9204@tamsun.tamu.edu (Brent) writes:
  14.  
  15. >maynard@esther.msc.cornell.edu (Maynard J. Handley) writes:
  16. >| We hear about how great object-orientation is (and I
  17. >|agree completely- I now shudder at the thought of coding in anything but
  18. >|C++) but what does object-orientation for OS get you, that a decent C++ API
  19. >|to a traditional OS does not?
  20.  
  21. >You are right, OOP is a good thing, but its features certainly can't be
  22. >used for everything.  I'd personally shudder at writing a UNIX C compiler
  23. >in C++.  What would the objects be?  Would they be function definitions?
  24.           ^^^^^^^^^^^^^^^^^^^^^^^^^
  25.  
  26. *****>    If you don't know, I'd respectfully suggest that you think some
  27.     more about it and perhaps avail yourself of information about
  28.     object-oriented design.
  29.  
  30.     Ignoring the language part of the compiler, even just doing the
  31.     bookkeeping of symbol-table management is really slick if you
  32.     have a nice SymbolTable class where the Symbol's are
  33.     user-definable via inheritance.
  34.  
  35. >Could they feasibly be individual statements where compound statement objects
  36. >would have other statement objects?  Yes, you could write it in C++ without
  37. >using all the object stuff, but the basic compilation process is too 
  38. >algorithmically intensive to bother with objects.  The ++ overhead would
  39. >slow down numerous method calls (the way C++ objects are implemented).
  40.  
  41. *****>    And wading through mongo switch() statements is so much faster?
  42.     Member-function calls are _only_ slower when the virtual
  43.     mechanism is used, but even then, it's only a couple of extra
  44.     memory references.  The alternative is switch() statements.  If
  45.     you change something, you have to go find all the places in
  46.     every switch statement that require a change.  Can you say
  47.     "bugs?"  The point is that even if virtual member functions are
  48.     a tad slower (and it's not humanly-perceptablly slower), I think
  49.     the benefit far outways the liability.
  50.  
  51. >The almost-classic example of an OOP application is the object
  52. >drawing program.  This type of application lends itself greatly
  53. >to OOP.  (A program like MacDraw).
  54.  
  55. >These above questions are exactly what I asked a fellow classmate in my
  56. >compiler design class.  We had to write a Pascal compiler using whichever
  57. >system we wanted.  I did it straightforwardly in C, and he talked about doing
  58. >it in C++.  He didn't turn in a working project.  This has two interpretations:
  59. >either the C++ realm was not fit for the project, or his programming skills
  60. >weren't fit for the project.  I personally think it was a combination of
  61. >the two; he had heard how great C++ is for everything and that he was trying
  62. >to make it work, but couldn't get it going.  I think this is more the case
  63. >because of what I know about him.  However, I'll never know for sure.
  64.  
  65. *****>    Well, I wrote a Pascal compiler in C++ and turned in the various
  66.     phases early.  I'm writing yet another compiler for a language
  67.     of my own in C++ and it makes life a lot easier.
  68. -- 
  69.     - Paul J. Lucas                University of Illinois    
  70.       AT&T Bell Laboratories        at Urbana-Champaign
  71.       Naperville, IL            pjl@cs.uiuc.edu
  72.