X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Message-ID: <411426DC.98717576@yahoo.com> From: CBFalconer Organization: Ched Research X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp,comp.lang.c Followup-To: comp.lang.c Subject: Re: Environment Variables References: <41115A5F DOT 7DDC6318 AT yahoo DOT com> <41127AF9 DOT 26DEA37C AT yahoo DOT com> <4112BE04 DOT 3B151CA1 AT yahoo DOT com> <7494-Fri06Aug2004121205+0300-eliz AT gnu DOT org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 61 Date: Sat, 07 Aug 2004 01:01:44 GMT NNTP-Posting-Host: 12.76.131.45 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1091840504 12.76.131.45 (Sat, 07 Aug 2004 01:01:44 GMT) NNTP-Posting-Date: Sat, 07 Aug 2004 01:01:44 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Brian Inglis wrote: > in comp.os.msdos.djgpp, "Eli Zaretskii" wrote: > >>> From: CBFalconer >>> Newsgroups: comp.lang.c,comp.os.msdos.djgpp >>> Date: Thu, 05 Aug 2004 23:27:28 GMT >>> >>> Changing the 'environ' name makes things become correct. gcc >>> seems to be creating a parameter to main, which is being accessed >>> by the identifier environ, even though the parameters are >>> specified to be void. gcc -E creates no reference to 'environ'. >> >> `environ' is a symbol that comes from the library. It is a pointer to >> an array of char *, where each array element is a string of the form >> "foo=bar": these are the environment variables and their values. >> >> I guess if this happens even under "-ansi -pedantic", it's a bug that >> we pollute the ANSI namespace with a non-ANSI symbol that doesn't bgin >> with an underscore. But given that Unix programs expect that symbol, >> I'm not sure we can change that. > > 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. > It was produced by compiling and linking a small dummy program, then > running nm -Cg, stripping the addresses, and editing out the > documented names. > 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 > > 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. ... snip possible djgpp temporary fix ... I am taking the liberty of crossposting this to c.l.c, where the problem originally arose, with follow-ups set to c.l.c. I think this is appropriate because you have created a generalized method of seeing the extent of the problem, for which thanks, at least in the unix/posix world. -- "The most amazing achievement of the computer software industry is its continuing cancellation of the steady and staggering gains made by the computer hardware industry..." - Petroski