missing g++ warning about bad allocation
Martin Ettl
ettl.martin@gmx.de
Thu Jul 2 20:25:00 GMT 2009
Hello,
compiling the following code with g++-4.4.0 on Ubuntu Linux (Jaunty):
int main()
{
double * d = new double[-100];
}
compiles without warning. I used following compilation flags: (-W -Wall -Wextra -pedantic).
Exectuting the compiled programm gives:
./test
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted
Is there a reason why g++ does not warn about this?
Best regards
Ettl Martin
--
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
More information about the Gcc-help
mailing list