This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
egcs-1.1a: new don't throw bad_alloc
- To: egcs at cygnus dot com
- Subject: egcs-1.1a: new don't throw bad_alloc
- From: Ryszard Kabatek <rysio at rumcajs dot chemie dot uni-halle dot de>
- Date: Wed, 9 Sep 1998 12:30:19 +0200 (CEST)
I installed the egcs-1.1a (with static libs) into a 'egcs' directory.
I still have the gcc 2.7.2.3 and egcs-2.90.27 980315 (egcs-1.0.2 release).
My configuration:
Linux (RedHat 5.1), Pentium II
binutils 2.9.1.0.4
The operator new don't throw bad_alloc if the allocation fails.
eg++ main.cc
a.out
Segmentation fault (core dumped).
// main.cc
# include <iostream.h>
# include <exception>
int main()
{
try {
char* p = new char[4000000000UL];
p[1000] = 'x';
delete [] p;
}
catch (exception& exc) {
cerr << exc.what() << '\n';
}
}
Ryszard Kabatek
Martin-Luther University Halle-Wittenberg
Department of Physical Chemistry
Geusaer Str. 88, 06217 Merseburg, Germany
Tel. +49 3461 46 2487 Fax. +49 3461 46 2129
e-mail: kabatek@chemie.uni-halle.de