egcs 1.1.1 / namespaces

Martin v. Loewis martin@mira.isdn.cs.tu-berlin.de
Wed Jan 6 13:40:00 GMT 1999


> The following results in C++ binding.
> extern "C" void Whatever(void);
> 
> namespace "me" {
> void Whatever(void){}
> }


Yes. ::Whatever is not me::Whatever. The global function has C
linkage, the one in the namespace does not.

Please post original source code with original error messages the next
time. There is no way your could ever compiled: A string after
'namespace' is illegal.

> The following results in C binding.
> extern "C" void Whatever(void);
> 
> namespace "me" {
> extern "C"
> void Whatever(void){}
> }

Yes. Both the global function and the one in the namespace have C
linkage. Due to a twist in the standard, they are actually the same
function.

> Looks like a bug to me.

It doesn't look like one to me :-)

There actually is a bug in that area

extern "C" void Whatever(void){}

namespace me {
extern "C" void Whatever(void){}
}

This should be rejected by the compiler, but is only rejected by the
assembler.

If you are not convinced, you'll need to elaborate.

Regards,
Martin



More information about the Gcc-bugs mailing list