Specify namespace of math functions to avoid name clashes

In the 4.6.x range of GNU compilers, the cmath header include math.h, adding
isinf() and isnan() to the global namespace as well as std. When used in if
statements, there is then an ambiguity between the std version which returns
bool and the global function which returns int; for more details see:
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891>

If we qualify the functions explicitly with their namespace, this error goes
away.
This commit is contained in:
Roland Kaufmann 2012-06-27 15:04:41 +02:00
parent 8bb70d9300
commit c4d99e3ea1
4 changed files with 4 additions and 4 deletions

View File

@ -553,7 +553,7 @@ int main(int varnum, char** vararg)
}
// Check for saneness of Ptestvalue:
if (isnan(Ptestvalue) | isinf(Ptestvalue)) {
if (std::isnan(Ptestvalue) || std::isinf(Ptestvalue)) {
cerr << "ERROR: Ptestvalue was inf or nan" << endl;
break; // Jump out of while-loop, just print out the results
// up to now and exit the program

View File

@ -713,7 +713,7 @@ int main(int varnum, char** vararg)
}
// Check for saneness of Ptestvalue:
if (isnan(Ptestvalue) | isinf(Ptestvalue)) {
if (std::isnan(Ptestvalue) || std::isinf(Ptestvalue)) {
if (isMaster) cerr << "ERROR: Ptestvalue was inf or nan" << endl;
break; // Jump out of while-loop, just print out the results
// up to now and exit the program

View File

@ -1187,7 +1187,7 @@ int main(int varnum, char** vararg)
}
// Check for saneness of Ptestvalue:
if (isnan(Ptestvalue) | isinf(Ptestvalue)) {
if (std::isnan(Ptestvalue) || std::isinf(Ptestvalue)) {
if (isMaster) cerr << "ERROR: Ptestvalue was inf or nan" << endl;
break; // Jump out of while-loop, just print out the results
// up to now and exit the program

View File

@ -1081,7 +1081,7 @@ int main(int varnum, char** vararg)
}
// Check for saneness of fracFlowRatioTestvalue
if (isnan(fracFlowRatioTestvalue) || isinf(fracFlowRatioTestvalue)) {
if (std::isnan(fracFlowRatioTestvalue) || std::isinf(fracFlowRatioTestvalue)) {
if (isMaster) cerr << "ERROR: fracFlowRatioTestvalue was inf or nan." << endl;
break; // Jump out out while-loop, just print the results up to now and exit
}