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

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!usc!cs.utexas.edu!torn!maccs!mcshub!aruba.uucp!ruby!philc
  3. From: philc@ruby.aruba.UUCP (Phil Calvin)
  4. Subject: Re: Return value for the constructors.
  5. Message-ID: <1992Aug20.122656.15072@aruba.uucp>
  6. Sender: philc@ruby (Phil Calvin)
  7. Date: Thu, 20 Aug 1992 12:26:56 GMT
  8. Distribution: usa
  9. References: <3462@unisql.UUCP> <1992Aug18.210426.19494@sunb10.cs.uiuc.edu> <H575V1E@netmbx.netmbx.de>
  10. Organization: Project Zed
  11. Lines: 23
  12.  
  13. In article <H575V1E@netmbx.netmbx.de>, jrobie@netmbx.netmbx.de (Jonathan Robie) writes:
  14.  
  15. |> But note this example from the ARM, page 62:
  16. |> 
  17. |>     complex* p = new complex(i++);
  18. |>     if (p == 0)  // allocation failed!
  19. |> 
  20. |> On page 61 he also states that initialization will only be done if the
  21. |> return from the new is nonzero.
  22. |> 
  23. |> So I think that it is safe to check the pointer to see if it is zero.
  24.  
  25. Isn't a more secure method provided by implementing a _new_handler function
  26. that deals with allocation failures??
  27.  
  28. That way, such pointer checks are unnecessary..
  29.  
  30. ...Phil
  31.  
  32. --------------------------------------------------------------------------
  33. Phil Calvin                      |Internet Style: aruba!philc@uu2.psi.com
  34. Systems Programming, Project Zed |UUCP: ...!uunet!uu2.psi.com!aruba!philc
  35. --------------------------------------------------------------------------
  36.