home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!usc!cs.utexas.edu!torn!maccs!mcshub!aruba.uucp!ruby!philc
- From: philc@ruby.aruba.UUCP (Phil Calvin)
- Subject: Re: Return value for the constructors.
- Message-ID: <1992Aug20.122656.15072@aruba.uucp>
- Sender: philc@ruby (Phil Calvin)
- Date: Thu, 20 Aug 1992 12:26:56 GMT
- Distribution: usa
- References: <3462@unisql.UUCP> <1992Aug18.210426.19494@sunb10.cs.uiuc.edu> <H575V1E@netmbx.netmbx.de>
- Organization: Project Zed
- Lines: 23
-
- In article <H575V1E@netmbx.netmbx.de>, jrobie@netmbx.netmbx.de (Jonathan Robie) writes:
-
- |> But note this example from the ARM, page 62:
- |>
- |> complex* p = new complex(i++);
- |> if (p == 0) // allocation failed!
- |>
- |> On page 61 he also states that initialization will only be done if the
- |> return from the new is nonzero.
- |>
- |> So I think that it is safe to check the pointer to see if it is zero.
-
- Isn't a more secure method provided by implementing a _new_handler function
- that deals with allocation failures??
-
- That way, such pointer checks are unnecessary..
-
- ...Phil
-
- --------------------------------------------------------------------------
- Phil Calvin |Internet Style: aruba!philc@uu2.psi.com
- Systems Programming, Project Zed |UUCP: ...!uunet!uu2.psi.com!aruba!philc
- --------------------------------------------------------------------------
-