G++ defines _GNU_SOURCE, implies C99

Daniel Jacobowitz drow@mvista.com
Fri Sep 13 16:06:00 GMT 2002


On Fri, Sep 13, 2002 at 06:58:16PM -0400, 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.
> 
> 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.
> 
> 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.

Is there such a PR for this one, or at least an archives pointer to
what needs to be done?  I no longer remember the discussion.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



More information about the Gcc-bugs mailing list