why does g++ not warn about division by zero?
Martin Ettl
ettl.martin@gmx.de
Sun Jun 21 12:06:00 GMT 2009
Hi,
i am wondering a bit why g++ (version 4.3.3,Ubunut-Jaunty,32-Bit) does not warn about a divsion by zero. I created a testcase do demonstrate:
#include <iostream>
template <typename T1, typename T2> inline T1 foo (T1 const& a, T2 const& b)
{
// ....
return a/b;
}
int main()
{
std::cout << foo(4.,0) << std::endl;
return 0;
}
I compiled the testprogramm with following command:
g++ -W -Wall -pedantic -o test test.cpp
g++ does not raise a warning!
Best regards
Ettl Martin
--
GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und Telefonanschluss
für nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
More information about the Gcc-help
mailing list