From: Charles Terry Newsgroups: comp.os.msdos.djgpp Subject: Re: bad_alloc exception Date: Wed, 01 Apr 1998 06:31:47 -0800 Organization: All USENET -- http://www.Supernews.com Lines: 32 Message-ID: <35224FD3.727E@plinet.com> References: <199804010554 DOT VAA22685 AT adit DOT ap DOT net> NNTP-Posting-Host: 6540 AT 207 DOT 174 DOT 3 DOT 153 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Nate Eldredge wrote: > > At 10:26 3/29/1998 -0800, Charles Terry wrote: > >Michael Krause wrote: > >> > >> Is there anyway to get the new operator to throw a bad_alloc exception > >> instead of just returning zero? > >> > >> Mike Krause > >> mhkrause AT umich DOT edu > >yes but you will have to download the source code and > >modify the new function and recompile. > > I don't think that's necessary, is it? My C++ knowledge is minimal, but I'm > pretty sure one of its major features is the ability to define your own > versions of operators. This can be done without tampering at all with the > library sources. > > Nate Eldredge > eldredge AT ap DOT net Yea that is how it works, I think SET also pointed that out. I do use c++ a bit but never had occasion to overload the standard operators- just class operators. But my impression was that to overload it had to be datatype::new(sizeof(datatype)). In otherwords the operator overloaded for a specific type. I agree recompileing the library is not neccesary but I'd still look at the library code to make sure I wasn't missing anything that could (and probably would) come back to haunt me. Charles