I was playing with typeid header-file in cpp. I passed a function name to the typeid function. When I did std::cout << ti.name() << std::endl I got FficE as output. I could figure out(kind of) everything except E. Can you guys explain how this works?
Here is the code:
#include <iostream>
#include <typeinfo>
float myFun(int num1, char num2){
return 25.34;
}
int main(void){
const std::type_info& ti2 = typeid(myFun); // O/P: FficE
/*
F: Function
f: float (return type)
i: integer (parameter 1)
c: character (parameter 2)
E: ?
*/
std::cout << ti2.name() << std::endl;
return 0;
}
I tried to read the official documentation but couldn't get much out of it. Also, I couldn't find a similar question asked here as well.
I'm using g++ as my compiler
The result of
std::type_info::nameis implementation defined.It looks like you're using some form of Itanium based compiler, see https://itanium-cxx-abi.github.io/cxx-abi/abi-mangling.html.
Fis a function,fis the float return type,icare theintandchararguments,Eis the end of the argument list.