Overloading vs. string functions, etc.

Mark Mitchell mark@codesourcery.com
Thu May 24 11:22:00 GMT 2001


Continuing yesterady's discussion, as I finish up the patches, I get
problems with code like:

  #include <cstring>
  using namespace std;

  void f(char *a, const char *b) {
    strcpy (a, b);
  }

I mentioned yesterday to Jakub that this problem was already showing
up with some functions.  The problem is that we have two overloads
with the same type in scope: the one provided by /usr/include/string.h
in the global namespace, and the `std' version thereof.

This is a pretty serious issue since a lot of people write code like
this.  What can we do before the release to solve this problem,
without tackling the whole problem of conformant headers?

How about `#define strcpy __glibcpp_strcpy' in std_cstring.h before
including /usr/includ/string.h?  I think that would do the trick.
Thoughts?

I will a GNATS bug report about this so that we do not forget.

Thanks,

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com



More information about the Libstdc++ mailing list