This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Namespace pollution?


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]