This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: egcs-1.1a: new don't throw bad_alloc


Ryszard Kabatek <rysio@rumcajs.chemie.uni-halle.de> writes:

> Linux (RedHat 5.1), Pentium II

> The operator new don't throw bad_alloc if the allocation fails.

It does.  Perhaps it is malloc() that is handling the unsigned value
passed to it as a signed one.  Running the program step-by-step shows
that malloc does return a non-null address.  Perhaps, in your case, it
is returning an invalid address.

I've tried smaller array sizes, such as 0x70000000, that won't fit in
my local virtual memory but will fit in a signed integer, and new did
throw bad_alloc.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]