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: Overloading vs. string functions, etc.


Mark Mitchell <mark@codesourcery.com> writes:

> 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?

Gaby, isn't this the same problem we had with fabs in <math.h>?  I've
just asked you for guidance on gcc-patches.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


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