delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/08/10/06:30:25

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Esa A E Peuha <esa DOT peuha AT helsinki DOT fi>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Environment Variables
Date: 10 Aug 2004 13:18:28 +0300
Organization: University of Helsinki
Lines: 48
Message-ID: <86p1xifjnyj.fsf@sirppi.helsinki.fi>
References: <cepqfs$jts AT odak26 DOT prod DOT google DOT com> <vY6Qc.33228$vX4 DOT 11673 AT cyclops DOT nntpserver DOT com> <41115A5F DOT 7DDC6318 AT yahoo DOT com> <bNtQc.58210$vX4 DOT 56203 AT cyclops DOT nntpserver DOT com> <41127AF9 DOT 26DEA37C AT yahoo DOT com> <4112BE04 DOT 3B151CA1 AT yahoo DOT com> <7494-Fri06Aug2004121205+0300-eliz AT gnu DOT org> <ufn7h0p3s00qq4vqmq3odgnt67i4hisdfn AT 4ax DOT com>
NNTP-Posting-Host: sirppi.helsinki.fi
X-Trace: oravannahka.helsinki.fi 1092133108 446 128.214.205.27 (10 Aug 2004 10:18:28 GMT)
X-Complaints-To: abuse AT helsinki DOT fi
NNTP-Posting-Date: 10 Aug 2004 10:18:28 GMT
X-Newsreader: Gnus v5.6.43/Emacs 19.34
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Brian Inglis <Brian DOT Inglis AT SystematicSw DOT Invalid> writes:

> FWIW below is a list of library symbols that pollute the user global
> namespace in *ALL* C programs and are not mentioned in the libc
> documentation.

Actually, most of them don't pollute the namespace at all.

> It was produced by compiling and linking a small dummy program, then
> running nm -Cg, stripping the addresses, and editing out the
> documented names. 

Giving the -C switch to nm is a bad idea, because you need the leading
underscores to know if a symbol can pollute the namespace; those with no
underscores don't pollute because they are inacessible from C, those
with more than one don't pollute because they are reserved to the
library.  Only the symbols with exactly one leading underscore can
pollute, and not even all of those do.

> The first letter tells you whether it's defined in a text, data or bss
> segment. 
> 
> D djgpp_first_ctor
> D djgpp_first_dtor
> D djgpp_last_ctor
> D djgpp_last_dtor
> D edata
> B end
> B environ
> T etext
> B exception_stack
> T start

Of these, the only one that does pollute at all is environ.

> ISTM that a reasonable first step would be to document the existence
> of these symbols in the libc documentation, and possibly add useful
> public interfaces to some header file, perhaps only for the case of
> environ, which seems to be the only symbol likely to be accessed by
> user level code. 

No, the reasonable first step is to fix it, since it's very easy to do.
I'll post the fix to the djgpp-workers list.

-- 
Esa Peuha
student of mathematics at the University of Helsinki
http://www.helsinki.fi/~peuha/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019