home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!netmbx!jrobie
- From: jrobie@netmbx.netmbx.de (Jonathan Robie)
- Subject: Re: Return value for the constructors.
- Organization: netmbx, Berlin, Germany
- Distribution: usa
- Date: Thu, 20 Aug 1992 07:18:53 GMT
- Message-ID: <9985KTQ@netmbx.netmbx.de>
- References: <3462@unisql.UUCP> <1992Aug18.210426.19494@sunb10.cs.uiuc.edu> <H575V1E@netmbx.netmbx.de> <1992Aug19.163545.25066@sunb10.cs.uiuc.edu>
- Lines: 24
-
- pjl@sparc10.cs.uiuc.edu (Paul Lucas) writes:
-
- >In <H575V1E@netmbx.netmbx.de> jrobie@netmbx.netmbx.de (Jonathan Robie) writes:
-
-
- >> complex* p = new complex(i++);
- >> if (p == 0) // allocation failed!
-
- >*****> No; the allocator new() is returning zero, not the constructor.
- > Also, if the ctor further allocates it's own stuff, there is
- > currently no clean way of returning that fact to the caller--
- > new() will return success, i.e., non-zero.
-
- >>On page 61 he also states that initialization will only be done if the
- >>return from the new is nonzero.
-
- I was trying to say that you can at least check to see if the memory
- allocation succeeded.
-
- --
- Jonathan
-
- ===========================================================================
-
-