This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
missing g++ warning about bad allocation
- From: "Martin Ettl" <ettl dot martin at gmx dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 02 Jul 2009 22:24:46 +0200
- Subject: missing g++ warning about bad allocation
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