Complex log builtins

Paul Brook paul@codesourcery.com
Mon Aug 30 14:33:00 GMT 2004


On Monday 30 August 2004 04:00, Gabriel Dos Reis wrote:
> "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
>
> [...]
>
> | If running those with the clog* builtins enabled doesn't break
> | something, it may just be that the compiler is different enough that
> | it's not longer a problem.  E.g. the new parser or builtins work may
> | have safely compartmentalized things.
>
> Assuming C99's clog is enabled, I don't know how the compiler managed
> to safely compartmentalize this:
>
>    #include <math.h>    // bring in C99's stuff
>    #include <iostream>  // bring in C++ streams
>
>    int main()
>    {
>       using namespace std;
>       clog << "Hellow, World\n";
>    }

The above testcase works with the builtins enabled. Adding a call to 
__builtin_clog to the body of main() also works.

Note that the C99 clog is declared in <complex.h>, not <math.h>.
Adding #include <compex.h> to the above test still works correctly because g++ 
overrides complex.h with a header that just does #include <complex>

Adding #include "/usr/include/complex.h" forces an explicit definition of 
clog, and does break the program.

In summary enabling the builtins doesn't seem to break anything, though I'm 
not sure why.

Does this help any?

Paul



More information about the Gcc mailing list