home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / std / cplus / 2102 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  1.7 KB

  1. Path: sparky!uunet!opl.com!regina!harvey
  2. From: harvey@opl.com (Harvey Reed)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Compiler should generate virtual destructors
  5. Message-ID: <harvey.727664973@regina>
  6. Date: 22 Jan 93 01:09:33 GMT
  7. References: <1992Dec31.050150.28929@ucc.su.OZ.AU> <lkc2k7INNajv@exodus.Eng.Sun.COM>
  8. Sender: news@opl.com
  9. Lines: 38
  10.  
  11. db@argon.Eng.Sun.COM (David Brownell) writes:
  12.  
  13. >...
  14. >So, a pair of proposals that I'd be happier to see accepted:
  15.  
  16. >   (1)    It is an error for a class to have virtual functions and a
  17. >    nonvirtual destructor.
  18. >    
  19. >   (2a) C++ compilers don't automagically generate ANYTHING for classes
  20. >    any more:  constructors, destructors, assignment and address-of
  21. >    operators, etc.  If such routines are used but not declared and
  22. >    defined, that is an error.
  23.  
  24.  
  25. I like this! Compilers could have "compatibility" switches, but for 
  26. those of us who would rather do it ourselves, we could use the
  27. full strength version.
  28.  
  29. I think I would feel a lot better about my C++ compiler if I didn't
  30. have to make a copy-ctor private/unimplemented (as a safegaurd) just
  31. because I was afraid that I *might* be accidentally copying an object.
  32. It would be much better if the compiler simply said it was an error
  33. to copy without a copy-ctor (or whatever), then the programmer can:
  34.  
  35. 1) remove the need to copy
  36. 2) install the proper method to do the copy
  37.  
  38. This goes for all the other automagic stuff too! I cringe when I 
  39. think about automagically adding virtual destructors, even though
  40. they are most times needed...
  41.  
  42.  
  43.  
  44. -- 
  45. ++harvey
  46. ===========================================================================
  47. internet:       harvey@opl.com  /  hreed@cs.ulowell.edu  /  h.reed@ieee.org
  48. voice/fax:      617-965-0220    /  617-965-7599
  49.