This is the mail archive of the
mailing list for the libstdc++ project.
Re: ::gets has not been declared
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: Tom de Vries <Tom_deVries at mentor dot com>, gcc at gcc dot gnu dot org, jason at redhat dot com, libstdc++ at gcc dot gnu dot org
- Date: Thu, 5 Jan 2012 17:33:37 +0100 (CET)
- Subject: Re: ::gets has not been declared
- References: <4F059229.email@example.com> <Pine.LNX.firstname.lastname@example.org>
- Reply-to: gcc at gcc dot gnu dot org
On Thu, 5 Jan 2012, Joseph S. Myers wrote:
On Thu, 5 Jan 2012, Tom de Vries wrote:
My hunch is that this recent glibc change causes/triggers the error:
* libio/stdio.h: Do not declare gets for ISO C11 and _GNU_SOURCE.
I see this both on ARM and MIPS.
Should I file this as a problem in gcc or glibc?
It's a bug in libstdc++ that it doesn't allow for headers that have
removed gets in accordance with C11.
And it is a bug for glibc to remove gets even when __cplusplus is defined.
Also, it used to be that _GNU_SOURCE meant "declare everything and more",
so it is surprising to now have it remove declarations, although it is
Do you have any suggestion on what libstdc++ can do when faced with C
libraries that will randomly declare gets or not depending on flags? It
would need knowledge of these exact flags so it can provide a replacement
exactly when it isn't declared (or at least remove the using ::gets in
that case, even if that is non-standard). The easiest workaround I can
think of is to implement a failsafe version of using in the front-end, but
there might be better solutions.
If the final C++11 still requires gets in <cstdio>, despite it being
removed in C11, that's probably also a bug in C++11. (At least the most
recent draft I have to hand still has gets in <cstdio>.)
It still has it. And it is based more on C99 than C11 (which didn't exist
at the time), even if they did try to synchronize on some features.