This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: G++ defines _GNU_SOURCE, implies C99
- From: Phil Edwards <phil at jaj dot com>
- To: Michael Eager <eager at mvista 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 18:58:16 -0400
- Subject: Re: G++ defines _GNU_SOURCE, implies C99
- References: <3D8268C7.9A18E107@mvista.com>
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.
Phil
--
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
- Edsger Dijkstra, 1930-2002