C++: "unqualified" linkage
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Mon Jan 17 17:22:00 GMT 2000
> Hey, but wait! What's wrong with using the plain old `extern "C"' to
> accomplish the same as your proposed extension?
Good question. The only answer I can think of right now is that it
would break the ABI. Also, consider
struct S{};
void foo(S*){}
namespace N{
extern "C" {
struct S{};
}
}
void foo(N::S*){}
void main()
{
S x;N::S y;
foo(&x);
foo(&y);
}
In Standard C++, this is a valid program. With that extension, that
would not be the case anymore (violation of the ODR). I don't know how
serious a problem that would be.
Regards,
Martin
More information about the Gcc-patches
mailing list