This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]