This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
Re: Namespace pollution?
>>>>> "KK" == Kaz Kylheku <kaz@ashi.footprints.net> writes:
[stuff snipped]
KK> On Mon, 1 Nov 1999, Steve Baker wrote:
>> Date: Mon, 1 Nov 1999 18:18:38 -0500 From: Steve Baker
>>
>> #include <stdio.h> include <sys/types.h> include <pwd.h>
>>
>> int uname;
This is a legal name, its not an ISO/ANSI name and therefore should
always work.
KK> This invokes undefined behavior. The above identifier is a
KK> reserved external name in a POSIX application, such as this
KK> program, since it refers to the name of an existing function.
SYSV/POSIX reserves the _uname name implicitly (the "underbar rule).
This is why we have write() and _write(). uname() is supposed to be a
weak binding and therefore be overwritten.
KK> It's more of a problem of the program's non-compliance rather
KK> than of namespace pollution.
Nope, It is name space pollution, clear and simple!
The strong binding of uname() should be _uname or __uname uname MUST
be weak (unless your on AIX which is a different matter all together).
check out:
http://www.unix-systems.org/single_unix_specification_v2/xsh/compilation.html
Usually if your working with elf (since you have weak bindings) you
just do it on everything (this way you don't break any standard).
-Jimi X