This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Builtins and C++ and such
--On Wednesday, March 20, 2002 12:28:57 AM -0300 Alexandre Oliva
<aoliva@redhat.com> wrote:
> On Mar 19, 2002, Mark Mitchell <mark@codesourcery.com> wrote:
>
>> (Somebody still has to tell me we can't just do this in headers for C++,
>> which is the language with the performance regression...)
>
> Lemme try:
>
> - std::memcpy and ::memcpy are supposed to be the same function
>
> - defining std::memcpy as an inline function that calls
> __builtin_memcpy would breaks this since C defines ::memcpy
>
> - defining an extern "C" inline ::memcpy would break the ODR since
> it's already defined in libc
That's a pretty good argument.
Worrying about the ODR is somewhat pedantic; we already probably
violate the ODR in some ways, and that's no big deal as long as
the definitions do close enough to the same thing.
But, I think your key point (std::memcpy and ::memcpy should have
the same address) is good. Does the standard actually talk about
::memcpy somewhere and say this, or are we just inferring it? (It
does make sense; I'm just curious whether the standard actually
requires this. I didn't know the stnandard talked about ::memcpy.)
I'll not buck the trend anymore; we'll find a way to do it in the
compiler. So, the above is just an academic question.
Thanks,
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com