This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: correct "C" headers, higher priority
- To: libstdc++ at gcc dot gnu dot org
- Subject: Re: correct "C" headers, higher priority
- From: Nathan Myers <ncm at nospam dot cantrip dot org>
- Date: Fri, 1 Jun 2001 10:49:46 -0700
- References: <20010531195437.A12954@shell7.ba.best.com> <Pine.SOL.3.91.1010531212636.1900A-100000@taarna.cygnus.com>
- Reply-To: libstdc++ at gcc dot gnu dot org
On Thu, May 31, 2001 at 09:29:56PM -0700, Benjamin Kosnik wrote:
>
> [biting my tongue]
>
> > They try to keep underlying C names (particularly nonstandard ones) from
> > polluting the global declaration space, although they cannot protect the
> > global link space. Maybe abandoning that goal is the secret to simplifying
> > them enough to make the idea practical.
>
> Yep. Something needs to be done, and this is a good place to start.
Of course the problem is that *some* names found in the underlying
C headers have to be hidden because C++ supplies something different.
For Koenig lookup, struct tm and struct lconv have to be defined in
std::, and definitions like strchr have to hide the C form. Furthermore,
whatever is visible globally must be, in fact, the same function as what's
in std:: (i.e. &strchr must equal &std::strchr).
The best thing that Glibc could do for us is to declare *all* their
functions something like this:
char* __glibc_strchr(const char*, int);
#define strchr __glibc_strchr
Then in the C++ headers we can just #undef strchr to avoid any conflict,
and provide our own. (We have to have the #undefs in any case.)
Nathan Myers
ncm at cantrip dot org