using std::FILE

Richard B. Kreckel kreckel at ginac.de
Mon Dec 17 20:43:04 CET 2007


Hi!

Marc Glisse wrote:
> On Sun, 16 Dec 2007, Richard B. Kreckel wrote:
>> Note that
>> including <stdio.h> is not enough, as it doesn't define namespace std.
> 
> That is a bug, the current standard says it should (that may change in 
> the next standard, but hasn't yet).

Are you sure? So, this is a bug in GCC?

rbk at wallace:~$ g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.3-20071130/configure --enable-languages=c,c++ 
--prefix=/home/rbk/gcc --disable-nls
Thread model: posix
gcc version 4.3.0 20071130 (experimental) (GCC)
rbk at wallace:~$ cat bug.c
#include <stdio.h>
#include <gmp.h>
rbk at wallace:~$ g++ bug.c
In file included from bug.c:2:
/usr/include/gmp.h:520: error: 'std::FILE' has not been declared
rbk at wallace:~$ g++ -std=c++0x bug.c
In file included from bug.c:2:
/usr/include/gmp.h:520: error: 'std::FILE' has not been declared

> And doing the same for std::size_t, std::ptrdiff_t, etc. There was a 
> patch on the list after 4.2.1 to do that, but it wasn't adopted.

And, also this?

rbk at wallace:~$ cat bug.cc
#include <stdlib.h>
using std::size_t;
rbk at wallace:~$ g++ bug.cc
bug.cc:2: error: 'std::size_t' has not been declared

This is rejected by all versions of g++ I have access to, from gcc 3.3 
to gcc 3.4 prereleases.

Can you, please, point out the relevant section in the standard and, if 
necessary, file a bug report for GCC?

Cheers
    -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>


More information about the gmp-bugs mailing list