Reply-To: From: "Arthur" To: "DJGPP Mailing List" , "Klaus Petzold" Subject: RE: Problem with "new" Date: Wed, 26 Aug 1998 17:53:20 +0100 Message-ID: <000001bdd112$07f8bc00$214e08c3@arthur> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit In-reply-to: <35e404cf.33475@news.space.net> Importance: Normal Precedence: bulk > Hi, > > I use gcc version 2.7.2.1 and I try to reserve some memory with "new". > My problem is, if there is not enough memory the program returns to > the OS (code 255), what I don't want. > How can I avoid this? > > tia... > ...Klaus... > > new returns NULL if memory allocation fails. You should always test for this. eg: int *a; a = new int; if(!a){ do_something() } I think this should work. James Arthur jaa AT arfa DOT clara DOT net ICQ#15054819