This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: Builtins in `std'


Andreas Jaeger <aj@suse.de> writes:

| Gabriel Dos Reis <gdr@codesourcery.com> writes:
| 
| > Mark Mitchell <mark@codesourcery.com> writes:
| > | In particular, I'm trying to fix a regression on code like:
| > | 
| > |   extern "C" double fabs (double) {}
| > | 
| > |   namespace std { 
| > |     double fabs (double) {}
| > |   } 
| > | 
| > | (A user is allowed to do this; they might have a different library
| > | implementation or something.)
| > 
| > The above is not allowed.
| 
| What is not allowed in this? 

I was talking about the ability for a third party do add such things
in std:: or declaring a C-library function provided by the C++ runtime
system. 

| ... In glibc's mathinline.h (included via
| <math.h> we have:
| 
| extern "C" {
| inline double fabs (double) throw ()  { return __builtin_fabs (__x); }
| }
| 
| and it bits/std_cmath.h also does:
| namespace std
| {
|   inline float
|   fabs(float __x) { return __builtin_fabsf(__x); }
| }
| 
| Is this a problem?

No, this is not a problem since the second has a C++ linkage and has a
different type.

(I'm tell you shortly what is happening with the example you sent me).

-- Gaby


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