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