using std::FILE

Marc Glisse marc.glisse at normalesup.org
Tue Dec 18 12:20:36 CET 2007


On Mon, 17 Dec 2007, Richard B. Kreckel wrote:

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

Try again with sun studio compilers on solaris.

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

I already pointed the relevant section of the standard on this list last 
week...
paragraph D.5.2

"Every C header, each of which has a name of the form name.h, behaves as 
if each name placed in the Standard library namespace by the corresponding 
cname header is also placed within the namespace scope of the namespace 
std and is followed by an explicit using-declaration (7.3.3)."

The related gcc bugs are easy to find (standard function declarations 
linking into global namespace 6257, __cplusplus still not defined as 
199711L 1773, etc) and are currently blocked. There is a defect report for 
the c++ standard that asks to make the current gcc behavior legal, 
claiming that doing otherwise requires cooperation from libc which is too 
hard (although solaris does it quite properly):
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#456
apparently they have decided to make what gcc does legal in the future 
revision of the standard and specify:
stdio.h declares FILE, cstdio declares std::FILE, and each one is 
allowed but not required to also declare it in the other namespace.

This list is not the best place to discuss this though.

-- 
Marc Glisse


More information about the gmp-bugs mailing list