home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12530 < prev    next >
Encoding:
Text File  |  1992-08-18  |  1.6 KB  |  39 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!m.cs.uiuc.edu!sunb10.cs.uiuc.edu!sparc6.cs.uiuc.edu!pjl
  3. From: pjl@sparc6.cs.uiuc.edu (Paul Lucas)
  4. Subject: Re: Return value for the constructors.
  5. Message-ID: <1992Aug19.011903.20901@sunb10.cs.uiuc.edu>
  6. Sender: news@sunb10.cs.uiuc.edu
  7. Organization: University of Illinois at Urbana-Champaign
  8. References: <3462@unisql.UUCP> <1992Aug18.210209.15023@watson.ibm.com> <3468@unisql.UUCP>
  9. Distribution: usa
  10. Date: Wed, 19 Aug 1992 01:19:03 GMT
  11. Lines: 26
  12.  
  13. In <3468@unisql.UUCP> nandraj@unisql.UUCP (Nandraj Arni) writes:
  14.  
  15. >> In article <3462@unisql.UUCP>, nandraj@unisql.UUCP (Nandraj Arni) writes
  16. >> :
  17. >> >
  18. >> >    Why does C++ not let you have a return value for a constructor?
  19. >> > Is there any rationale behind this?
  20. >> 
  21. >> Before we answer that question, we should ask what do you want it for?
  22. >> A language can't provide every conceivable feature; unless a feature is a
  23. >> significant improvement to the language, it is an unnecessary complicati
  24. >> on.
  25.  
  26. >  The reason I think it is a important feature the constructor should
  27. >return whether it was a success or not? Say I want there is a time
  28. >class which takes in put as MM/DD/YY. If the values were out of range
  29. >for an instance of this class, the user should know that it was a bad
  30. >way to construct this class. OR say it could not allocate memory...
  31.  
  32. *****>    You should have said that originally.  *THAT* purpose is one of
  33.     the things that the forthcoming excpetion-handling feature will
  34.     address.
  35. -- 
  36.     - Paul J. Lucas                University of Illinois    
  37.       AT&T Bell Laboratories        at Urbana-Champaign
  38.       Naperville, IL            pjl@cs.uiuc.edu
  39.