OpenMP vs. <math.h>

Yaakov (Cygwin/X)
Tue Jan 12 21:08:00 GMT 2010

On 12/01/2010 13:29, Dave Korn wrote:
> Why is the solution to penalise all the correct and valid C++ code out there
> instead of to fix the few buggy bits and pieces that don't conform to the
> language standard?

Actually, I proposed two solutions to the Cygwin list last week, one of 
them being to fix the OpenMP headers.  But it was pointed out that this 
would affect all Newlib platforms and apparently does not affect Linux 
or other platforms which support OpenMP.

But thinking about this further, there's just no way that these macros 
would ever be safe with C++.  Take this for a simple example:

$ cat > log2.cxx <<_EOF_
#include <cmath>
#include <iostream>

     std::cout << ::log2(42) << std::endl;
     return 0;

$ g++ -c log2.cxx
log2.cxx: In function ‘int main()’:
log2.cxx:8: error: expected id-expression before ‘(’ token

So this isn't just a problem with OpenMP, this is a potential problem 
with all C++ code.


More information about the Newlib mailing list