This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


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

Re: correct "C" headers, higher priority


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


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