missing g++ warning about bad allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux