'throw' in new operator
Rafal Lukawski
rafal@dumb.iinf.polsl.gliwice.pl
Sat Jun 13 03:10:00 GMT 1998
Hi,
the following program causes 'Aborted (core dumped)':
---- cut -----
#include <iostream.h>
#include <stdlib.h>
void *operator new(size_t size)
{
if(size>1000000)
throw(10);
return malloc(size);
}
int main()
{
try {
char *buf=new char[1024*1024];
}
catch(int)
{
cerr <<"no enough memory\n";
exit(-1);
}
}
---- cut --------
rafal[1]:~/work/test/cc$ g++ --version
egcs-2.91.40
rafal[1]:~/work/test/cc$ g++ d.cc -o d
rafal[1]:~/work/test/cc$ ./d
Aborted (core dumped)
--
Rafal Lukawski mailto:rafal@gliwice.pl , voice: (+48) 602 266 876
System Administrator - dumb.iinf.polsl.gliwice.pl
More information about the Gcc-bugs
mailing list