digitalmars.D.learn - function type stringification
- Timothee Cour (30/30) Jul 08 2013 I'm a bit confused with the behavior of function type stringification:
I'm a bit confused with the behavior of function type stringification: ---- int main(string[]args){ auto foo=&main; pragma(msg,typeid(typeof(foo))); pragma(msg,typeid(typeof(foo)).stringof); //pragma(msg,typeid(typeof(foo))); import std.stdio; writeln(typeid(typeof(foo)).stringof); writeln(typeid(typeof(foo))); writeln(typeof(&main).stringof); writeln(typeid(typeof(main)).stringof); writeln(typeof(main).stringof); return 0; } ---- dmd -run main.d: & D17TypeInfo_PFAAyaZi6__initZ &D17TypeInfo_PFAAyaZi6__initZ &D17TypeInfo_PFAAyaZi6__initZ int()* int function(string[] args) &D16TypeInfo_FAAyaZi6__initZ int(string[] args) A) pragma(msg,typeid(typeof(foo))); adds an extra space compared to pragma(msg,typeid(typeof(foo)).stringof); B) can someone please explain the behavior of each stringification? Eg, writeln(typeid(typeof(foo))) discards input argument types (int()*), etc.
Jul 08 2013