function type stringification
Timothee Cour
thelastmammoth at gmail.com
Mon Jul 8 20:25:50 PDT 2013
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130708/f2180a9d/attachment.html>
More information about the Digitalmars-d-learn
mailing list