This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Overloading vs. string functions, etc.
Mark Mitchell <mark@codesourcery.com> writes:
| >>>>> "Gabriel" == Gabriel Dos Reis <gdr@codesourcery.com> writes:
|
| Gabriel> That would work only if the host <string.h> doesn't
| Gabriel> protect strcpy declaration against macro expansion.
|
| Do you mean with something like:
|
| #ifndef strcpy
| extern char * strcpy (...);
| #endif
|
| ? Yes, that would be a problem.
Yes. Or something like
#undef strcpy
extern char *strcpy(...);
The two hosts I have access to (a solaris and a gnu/linux) don't seem
to protect against macro expansion; but I can't conclude anything since
experience has proved that they are not representative in trickyness :-)
A more serious problem is macro-redefinition. A host is free to
provide both function and macro definitions.
My system (a GNU/Linux) doesn't do it for strcpy, but it does it for
memcpy, memset, strchr. However, if we do not diagnose macro
redefinition in system headers then your proposal won't make things
worse than they are currently.
-- Gaby
CodeSourcery, LLC http://www.codesourcery.com