Mail Archives: djgpp-workers/2004/08/11/08:39:47
Eli Zaretskii wrote:
>> From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
>>
>> Instead of putting environ in djgpp.djl, could we use a define
>> statement in a header outside the ansi and posix definitions?
>
> I think we cannot do this because Posix explicitly says that
> environ is not declared in any header.
>
> In other words, a Posix program that uses environ is not
> required to include any system header, and it still can expect
> environ to be available.
Just thinking out loud. That means that, within main only, and in
the DJGPP stack environment, the system has to translate the word
'environ' to access the space for a third parameter to main. This
is in the compiler proper. That access has to be removed if the
-ansi directive is in force. After that, the presence or absence
of environ in the names resolved by the library is not germane,
provided the resolution involves only a separate module so that it
will not be loaded if not already resolved. The fact that the
runtime loads a third parameter value for main does not matter,
since it is no more programmatically accessible than is the stack
marker (return address, etc.).
However if main is declared with a third parameter, under any
name, the normal mechanisms will provide access to it. i.e. the
thing to disable, under -ansi, is specifying that third parameter
in the main header. Then gcc -ansi will barf if, in a main, it
finds:
int main(int, char **, anything)
Thus the library proper is not affected, and can supply any names
desired in either user or system space, provided they are in
separate modules and not loaded unless specified. The whole thing
is therefore a GCC bug, not a library bug.
--
"Churchill and Bush can both be considered wartime leaders, just
as Secretariat and Mr Ed were both horses." - James Rhodes.
"A man who is right every time is not likely to do very much."
- Francis Crick, co-discover of DNA
- Raw text -