Overloading vs. string functions, etc.
Andreas Jaeger
aj@suse.de
Thu May 24 12:54:00 GMT 2001
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
More information about the Libstdc++
mailing list