This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Name Mangling Without Return Type?
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: "Corn Hulio " <nitrogenycs at firemail dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: 02 Dec 2003 11:09:37 -0500
- Subject: Re: Name Mangling Without Return Type?
- References: <1070380905003650@lycos-europe.com>
"Corn Hulio " <nitrogenycs@firemail.de> writes:
> say u have a function like
>
> bool Class::SomeFunc(int param1, COtherClass param2);
>
> If the function name gets mangled and i try to unmangle it, i am unable to retrieve the
> return type of it (bool in this case). Isn't there the
> possibility to include it into the mangled name so i can get it back when unmangling?
> msvc does this for example (i know gcc is not msvc) and i
> think it is a very useful feature, especially for applications similar to the one
> described here: http://www.drizzle.com/~scottb/gdc/fubi-paper.htm
> . Can you maybe add a compiler switch or other way that includes the return type? Or am
> I totally wrong here and the return type is already in
> the mangled name?
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.
If there were an option to add the return type to the mangled name,
which there is not, then you would have to recompile all C++ library
code with that option. Otherwise you would not be able to call any
functions, because the compiler would be generating the wrong name.
Ian