Is there a good reason why this program compiles under GCC even with the -ansi
and -pedantic
flags?
#include <cmath>
int main (int argc, char *argv [])
{
double x = 0.5;
return static_cast<int>(round(x));
}
This compiles clean (no warnings, even) with g++ -ansi -pedantic -Wall test.cpp -o test
.
I see two problems:
round()
shouldn't be available to C++ in ISO-conformant mode (since it comes from C99)- Even if
round()
were available in this case, it should only be so from thestd
namespace
Am I wrong?