From: "Luke Bishop" Newsgroups: comp.os.msdos.djgpp Subject: Re: new operator Date: 17 Feb 1998 22:13:59 GMT Organization: The Zone Lines: 11 Message-ID: <01bd3a84$3863ca80$0201a8c0@technoid> References: <6cacaa$c5n1 AT walter DOT wcom DOT com> NNTP-Posting-Host: n072h123.thezone.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk > In DJGPP, does the new operator throw an exception if it cannot allocate > the requested memory? Or does it just return a NULL value.? No, worse still. DJGPP's LIBC standard new handler dumps you to DOS if it cannot allocate the memory. To avoid this, you should overload the new operator and call malloc manually inside the overloaded operator. Watch out for virtual functions, though, because DJGPP will assign your VFTBL to a NULL just as easily as to real memory. Also, if your overloaded new returns null, class construction continues anyway and the constructor is called with a this pointer of NULL.