This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: G++ defines _GNU_SOURCE, implies C99
- From: Michael Eager <eager at mvista dot com>
- To: Phil Edwards <phil at jaj dot com>
- Cc: gcc <gcc at gcc dot gnu dot org>, GCC Bugs <gcc-bugs at gcc dot gnu dot org>
- Date: Fri, 13 Sep 2002 16:32:55 -0700
- Subject: Re: G++ defines _GNU_SOURCE, implies C99
- Organization: MontaVista Software, Inc.
- References: <3D8268C7.9A18E107@mvista.com> <20020913185816.A18720@disaster.jaj.com>
Phil Edwards wrote:
>
> On Fri, Sep 13, 2002 at 03:37:59PM -0700, Michael Eager wrote:
> > So, can anyone elucidate why _GNU_SOURCE is defined by G++ and
> > not by GCC and/or why it implies _USE_ISOC99?
>
> C++ requires more smarts from the C library, and from the surrounding
> environment, than most languages. With current C++ library sources and
> current typical system headers, the only way to get that support is to
> request extra standards-conforming behavior. Usually this is for I/O.
What C99 behavior is required by C++?
> For Linux, the c++ compiler defines _GNU_SOURCE. For Solaris, it defines
> (or used to?) _XOPEN_SOURCE. For (whatever platform), it defines (whatever
> it needs to get the system to give the mandated behavior).
>
> The side effects are: 1) programs with older, sloppier code suddenly
> don't work, or work in surprising ways, and 2) users are exposed to newer
> unrequested features, if _GNU_SOURCE (or whatever) turns on more than what
> we were expecting, or needing.
>
> > And why this is
> > not a bug?
>
> It is a bug. Usually there is a single PR left open to remind everyone
> of this fact; the canonical one containing the best explanation of the
> situation.
PR 2082 is closed. I didn't find another.
> The "bug" (design flaw, more precisely) is that the C++ headers need some
> rewriting to make these macros unneeded, but for all the bitching and
> moaning over the effects of this misdesign, nobody has yet contributed
> the time to do so.
I'm not bitching and moaning, but the explaination that "more smarts
are needed" is a bit too nebulous to grab ahold of.
For this one small part of the problem, does _GNU_SOURCES really need
to define _USE_ISOC99?
--
Michael Eager eager@mvista.com 408-328-8426
MontaVista Software, Inc. 1237 E. Arques Ave., Sunnyvale, CA 94085