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.


Andreas Jaeger <aj@suse.de> writes:

| Gabriel Dos Reis <gdr@codesourcery.com> writes:
| 
| > Andreas Jaeger <aj@suse.de> writes:
| > 
| > | > 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.
| > 
| > The fabs() issue was even more pernicious: glibc provides another
| > -definition- for fabs when optimization is on.  The end results are
| 
| Why was the definition different?  Is it the throw() clause?

No, it is because glibc's definition appears in the global namespace
whereas V3 defines it in namespace std.

| > the same: programs can't get compiled :-(
| > 
| 
| I see.  Since - on Linux - we can change the C Library (glibc) to work
| correctly together with the C++ Library, could somebody explain in
| more detail to me what is allowed for glibc and what not?

It would be great if glibc provided C functions directly in namespace
std :-)

| We could fix this for the next glibc release if we all agree what
| needs to be done and how it should be done.
| 
| So, what can glibc do and what should glibc not do under C++
| compilation (and please explain why, I'd like to learn a bit;-):
| - Declare macros, e.g. for memcpy?

it would be helpful if glibc does not declare macros for C functions.
(assert() remains a macro).

| - Declare inline functions like fabs or strlen?

If they are defined directly in namespace std, then there would be
no thing for V3 to do in that area.  However there are function for
which C++ changes the signature (sorry, I don't have the list handy),
but they are rare.

| - Declare C functions and inline functions with throw()

Since the exception-specification is not part of the function
signature, the definition with throw() is harmless.

| - anything else?

Provide C99 functions in namespace std::c99 :-)

Thanks for your help.

-- Gaby
CodeSourcery, LLC                       http://www.codesourcery.com


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