This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


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

Re: environ and -D_GNU_SOURCE


>>>>> Wolfgang Sourdeau writes:

 > Hi,
 > I need to access (char**) environ from one of my programs. But looking
 > at unistd.h, I noticed I had to define _GNU_SOURCE at compile time to
 > be able to reach it, although __environ would else be available.
 > I don't understand why, since this variable is not specific to GNU.

__environ is an internal variable and shouldn't be used.  It might be
that we remove it in the next release.

environ is not part of any standard AFAIK - and therefore you need
_GNU_SOURCE.  If it would be, you would get it via one of the other
feature test macros.  We can't allow it without any feature test
macro, since this would violate standards like ISO C or POSIX that not
only specify what has to be in a header - but also forbid anything
else.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de


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