This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
Re: Namespace pollution?
- To: glibc-linux at ricardo dot ecn dot wfu dot edu
- Subject: Re: Namespace pollution?
- From: Steve Baker <ice at mama dot indstate dot edu>
- Date: Tue, 2 Nov 1999 00:27:04 -0500
- Reply-To: glibc-linux at ricardo dot ecn dot wfu dot edu
Kaz Kylheku <kaz@ashi.footprints.net> writes:
> > After spending many an hour debugging a program I have been working on
> > I've distilled a problem to the following (apologies if this is a known
> > problem):
> >
> > -------
> > #include <stdio.h>
> > #include <sys/types.h>
> > #include <pwd.h>
> >
> > int uname;
>
> This invokes undefined behavior. The above identifier is a reserved external
> name in a POSIX application, such as this program, since it refers to the
> name of an existing function.
>
> It's more of a problem of the program's non-compliance rather than of namespace
> pollution.
True, but when you include all the usual headers (unistd, stdlib, stdio,
pwd) and compile against -Wall, --strict-prototypes and get no warnings,
it's a little frustrating. The real problem of course are libraries that
load other libraries, which was what was happening in this case and the
dynamic linker not flagging the conflict.
Perhaps libdl needs improvment?
At any rate, it's difficult to know you're not in compliance if you're not
getting any warnings. Sue me.
- Steve