This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: gets with C++ and GCC before 4.7
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: libc-alpha at sourceware dot org, libstdc++ at gcc dot gnu dot org
- Date: Fri, 9 Mar 2012 20:57:07 +0000 (UTC)
- Subject: Re: gets with C++ and GCC before 4.7
- References: <Pine.LNX.4.64.1203052335580.17538@digraph.polyomino.org.uk> <Pine.LNX.4.64.1203080131220.20670@digraph.polyomino.org.uk> <CADZpyizSrJ95Trybfrb9nbcg772z4hyN4VjbiNPRc08ghJKoEA@mail.gmail.com> <Pine.LNX.4.64.1203081146480.9980@digraph.polyomino.org.uk> <20120309184929.680072C0A7@topped-with-meat.com> <Pine.LNX.4.64.1203091959050.16963@digraph.polyomino.org.uk> <20120309205000.634EC2C096@topped-with-meat.com>
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