[Mesa-dev] Mesa (master): glsl: Add using statements for standard library functions.

José Fonseca jfonseca at vmware.com
Fri Feb 4 10:36:33 PST 2011


On Fri, 2011-02-04 at 09:58 -0800, Ian Romanick wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 02/03/2011 10:36 PM, Jose Fonseca wrote:
> > This is very odd behavior from Sun's compiler -- unless we include
> > cstdio, printf should be available, not std::printf.
> 
> I think we might use cstdio in some places.  I find it odd that Sun's
> compiler differs from GCC, Visual Studio, ICC, and clang.  I'm tempted
> to say they're doing it wrong.  Is there perhaps a command line option
> for Sun's compiler that could change this behavior?  Not only is having
> to add extra using statements ugly, but I can guarantee it will be
> missed in the future.
> 

If we include cstdio then that would explain it.

If cstdio is implemented with something like:

   namespace std {
   #include <stdio.h>
   };

Then

  #include <cstdio>
  #include <stdio.h>

and

  #include <stdio.h>
  #include <cstdio>

may give different results.

> Maybe the better answer is to not use cstdio and friends at all.

I agree. If there is the change we also use stdio.h somewhere (and there
is because we include some mesa headers), then it's probably better to
stay away from cstdio and friends.

Jose



More information about the mesa-dev mailing list