This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Builtins in `std'
Mark Mitchell <mark@codesourcery.com> writes:
| OK. But since we're violating the ODR here, is there a chance that
| a user notices it? (I'm asking because I'm not sure)
|
| I can't think of any way that they could. But, it's hard to convince
| yourself 100% of these things.
|
| | 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.
|
| Because the user is not allowed to put things in `std', or for some
| other reason?
Basically for the same reason: Because the user is not allowed to put
things in std::, nor declare a C-library name with a C-linkage.
But now that I understand you concerns, I completely agree that the
optimized versions should be named __builtin_xxx.
[...]
| I'm trying to solve two problems at once: fix the bizarre error for
| the code above, and also simplify the compiler. There's a lot of
| (partially wrong) logic in the compiler to deal with users redeclaring
| builtins; it would be simpler if we could just avoid that hapenning by
| not sticking builtins in `std'.
I understand. I think your approach is Good :-)
-- Gaby