gcc builtin functions, e.g. memcpy, and namespace std

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Thu May 18 23:44:00 GMT 2000


> Regardless, the standard requires declared names in different 
> namespaces to be considered different for purposes of name lookup
> even if they would collide at link time.

No, it doesn't. 7.5/6 says

# At most one function with a particular name can have C language
# linkage. Two declarations for a function with C language linkage
# with the same function name (ignoring the namespace names that
# qualify it) that appear in different namespace scopes refer to the
# same function. Two declarations for an object with C lan­guage
# linkage with the same name (ignoring the namespace names that
# qualify it) that appear in different namespace scopes refer to the
# same object.

> The problem is that in some cases a C function as declared in a
> C header has been replaced by two different C++ functions, e.g.
> in the case of strchr(), to fix a const-correctness hole.
> Then, they *cannot* be the same.

Of course not. They have C++ linkage, whereas the original function
has C linkage.

Regards,
Martin


More information about the Libstdc++ mailing list