egcs-1.1a: new don't throw bad_alloc
Alexandre Oliva
oliva@dcc.unicamp.br
Thu Sep 10 03:53:00 GMT 1998
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
More information about the Gcc
mailing list