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