home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16559 < prev    next >
Encoding:
Text File  |  1992-11-19  |  1.4 KB  |  31 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!pipex!warwick!bham!bhamvx!mccauleyba
  3. From: mccauleyba@vax1.bham.ac.uk (Brian McCauley)
  4. Subject: Re: Using *new* safely
  5. Sender: usenet@rs6000.bham.ac.uk (USENET News Service)
  6. Message-ID: <1992Nov19.132341.1@vax1.bham.ac.uk>
  7. Date: Thu, 19 Nov 1992 13:23:41 GMT
  8. Lines: 19
  9. References: <bruceb.722124804@babel.cltr.uq.oz.au>
  10. Organization: University of Birmingham
  11.  
  12. In article <bruceb.722124804@babel.cltr.uq.oz.au>, bruceb@ctpm.uq.oz.au (Bruce Blackshaw) writes:
  13. > I'm interested in how to safely use the new operator in the constructor of
  14. > a complex object - if you are dynamically allocating the instance of a class
  15. > that itself dynamically allocates in its constructor, how do you stop crashes
  16. > due to failure of new?
  17.  
  18. Throw and exception in your new_handler. The example you cite is probably
  19. most important reason for the introduction of exeption handling.
  20.  
  21. If you don't have exception handling yet my advice is wait - it will
  22. probably take as long for you to solve the problem without exceptions
  23. as it will for your compiler to catch up!
  24. -- 
  25.     \\   ( )    No Bullshit!     |  Email: B.A.McCauley@bham.ac.uk   
  26.  .  _\\__[oo        from         |  Voice: +44 21 471 3789 (home)
  27. .__/  \\ /\@    /~)  /~[   /\/[  |    Fax: +44 21 625 2175 (work)
  28. .  l___\\      /~~) /~~[  /   [  |  Snail: 197 Harborne Lane,
  29.  # ll  l\\    ~~~~ ~   ~ ~    ~  |         Birmingham, B29 6SS, UK
  30. ###LL  LL\\   (Brian McCauley)   |   ICBM: 52.5N 1.9W
  31.