delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/09/10:27:10

From: pavenis AT lanet DOT lv
Message-ID: <B0000089996@stargate.astr.lu.lv>
To: salvador <salvador AT inti DOT gov DOT ar>, djgpp AT delorie DOT com
Date: Wed, 9 Jun 1999 17:26:57 +0300
MIME-Version: 1.0
Subject: Re: memory
In-reply-to: <375E7208.D3BBE4AB@inti.gov.ar>
X-mailer: Pegasus Mail for Win32 (v3.11)
X-MIME-Autoconverted: from Quoted-printable to 8bit by delorie.com id KAA28988
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 9 Jun 99, at 10:54, salvador wrote:

> Mattias Eklöf wrote:
> 
> > > how can I make an array with c++ in dos with 1Meg?
> >
> > char* pArray = new char[1024*1024];
> > if (pArray == 0) cerr << "Oops...! Time to buy more memory!" << endl;
> 
> ^^^^ Hmmm... I think new won't return 0 but instead will rise an
> exception.
> Can anybody confirm?
> 

Depends on compiler version. At least prereleases of upcomming 
gcc-2.95 even complains on attempt to return NULL pointer from
operator new. It says one should throw exception.

At least when new_handler is not specified gcc-2.95 prerelease 
throws exception. I only looked at sources, not really try to 
trigger this error.

Perhaps earlier versions will simply return NULL.

Andris

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019