This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Name Mangling Without Return Type?
Ian Lance Taylor wrote:
> Name mangling exists to disambiguate overloaded functions in C++. You
> can only overload functions based on the parameter types. You can not
> overload them based on the return type. So the return type is not in
> the mangled name. There is no need for it.
Indeed. For the same reason, Java has also used the same
mangling scheme (in GCJ, that is) and this is one of the
reasons (as I understand) that allows almost seamless
Java <-> C++ code mingling via CNI.
The thing is, you can't overload methods based solely
on return types in Java source, but you *can do it* in
the JVM bytecode!
This was not a problem at all, till very recently: the
candidate proposal that most likely will be the
implementation of generics in Java in JDK 1.5, exploits
this "feature":
http://homepages.inf.ed.ac.uk/wadler/gj/
See this thread for an example of what problems this
creates:
http://gcc.gnu.org/ml/java/2003-10/msg00121.html
So if GCJ wants to support generics, it has to
figure out a proper way of dealing with this.
Ranjit.
--
Ranjit Mathew Email: rmathew AT hotmail DOT com
Bangalore, INDIA. Web: http://ranjitmathew.tripod.com/