This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: G++ defines _GNU_SOURCE, implies C99


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]