This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: gets with C++ and GCC before 4.7
On Fri, 9 Mar 2012, Roland McGrath wrote:
> > As I understand it, the libstdc++ maintainers would prefer to have gets
> > declarations for C++ up to and including C++11, following the C++
> > standard, and only disable the declaration in a future C++17 mode. That
> > is, the state immediately after my commit
> > 8ecd6b2a1283a28bcf56cfe48099fafa412a3929 would be preferable to them, and
> > from their point of view no such macro would need to be defined because
> > C++17 mode would use a newer __cplusplus value to disable the declaration.
>
> If C++11 says that #include <stdio.h> should declare gets regardless
> of things like feature-test macros, then it seems pretty cut and dry.
Should I then remove the __USE_GNU test from inside the C++ case? That's
fine with me.
Feature-test macros are outside the scope of ISO C++. But _GNU_SOURCE is
always defined by GCC when compiling C++ code, because libstdc++ needs
functionality from the C library that's outside pure ISO C and C++, so
there is no way to tell whether the user wanted the strict ISO C++ library
or the GNU variant - and developing a way to make the relevant
functionality visible to libstdc++ in a namespace-clean way, so that a
user can choose what becomes visible from the C library, would certainly
be a substantial project.
--
Joseph S. Myers
joseph@codesourcery.com