home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 18741 < prev    next >
Encoding:
Text File  |  1993-01-06  |  1.7 KB  |  37 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnews!cbnewsm!cbnewsl!psrc
  3. From: psrc@pegasus.att.com (Paul S R Chisholm)
  4. Subject: Re: why `int X: :X()' ?
  5. Reply-To: psrc@pegasus.att.com (Paul S R Chisholm)
  6. Organization: AT&T Bell Laboratories
  7. Distribution: na
  8. Date: Wed, 6 Jan 1993 05:22:27 GMT
  9. Message-ID: <1993Jan6.052227.7278@cbnewsl.cb.att.com>
  10. Summary: it's not int!
  11. References: <1992Dec30.172537.12477@csi.jpl.nasa.gov>
  12. Sender: psrc@cbnewsl.cb.att.com (Paul S. R. Chisholm)
  13. Lines: 22
  14.  
  15. (By the way, "X: :X" isn't valid; "::" is a token, and can't be broken
  16. up.  See the ANNOTATED REFERENCE MANUAL or "ARM", sections 2.1 and 2.4,
  17. p. 5-7.)
  18.  
  19. In article <1992Dec30.172537.12477@csi.jpl.nasa.gov> mwette@csi.jpl.nasa.gov (Matt Wette) writes:
  20. >Why are constructor and destructor functions usually declared to return
  21. >ints when the usage typically warrents a `void' declaration.
  22.  
  23. Most functions return int if they don't declare what they return.  If
  24. they don't return anything, they should declare a return type of void.
  25.  
  26. Constructors and destructors are special cases.  By definition, they
  27. don't return anything; they don't have return types.  ARM, section
  28. 12.1, p. 265:  "No return type (not even void) can be specified for a
  29. constructor.  A return statement in the body of a constructor may not
  30. specify a return value."  Section 12.4, p. 276:  "A destructor takes no
  31. arguments, and ont return type can be specified for it (not even
  32. void)."
  33.  
  34. Paul S. R. Chisholm, AT&T Bell Laboratories/EasyLink Services,
  35. att!pegasus!psrc, psrc@pegasus.att.com, AT&T Mail !psrchisholm
  36. I'm not speaking for the company, I'm just speaking my mind.
  37.