egcs 1.1.1 / namespaces
Michael Marxmeier
mike@msede.com
Wed Jan 6 13:40:00 GMT 1999
Hello Martin.
> If you declare one of them extern "C", as in
>
> extern "C" void foo(){}
> namespace X{
> void foo(){}
> }
>
> they are *still* different functions. The first one of them is "C
> compatible" (i.e. it has "C" linkage), the second one is not.
Ok, understood. Thanks for the insight.
> > > > extern "C" void Whatever(void);
> > > >
> > > > namespace "me" {
> > > > extern "C"
> > > > void Whatever(void){}
> > > > }
> [...]
> > That would be fine for me but the name is mangled for the function
> > defined inside the namespace. And *that* smells like a bug.
>
> Platform? Exact compiler version? Full program input? Error messages?
Oops. Sorry for the confusion - my mistake. The example above works
as explained by you. The one defined w/o the extern "C" in the
namespace got the name mangled.
I fixed my code (by trivially adding the extern "C" before the function
definition) so i can live with that. I was just cought by surprise.
If the extern "C" inside the namespace is understood as a shortcut
to temporarily get out of the namespace this is fine for me.
Though this might be worth a warning with the Weffc++ level?
Thanks a lot for your help
Michael
--
Michael Marxmeier Marxmeier Software GmbH
E-Mail: mike@msede.com Besenbruckstrasse 9
Voice : +49 202 2431440 42285 Wuppertal, Germany
Fax : +49 202 2431420 http://www.msede.com/
More information about the Gcc-bugs
mailing list