Thread overview | ||||||
---|---|---|---|---|---|---|
|
May 20, 2005 Typeid for functions | ||||
---|---|---|---|---|
| ||||
DMD0.124, winXP. The following code prints "int()*". Shouldn't it be "int(int)*" ? The same occurs on delegates too. <code> import std.stdio; void main() { writefln(typeid(int function(int))); } </code> -tetsuya |
May 22, 2005 Re: Typeid for functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to tetsuya | tetsuya wrote: > DMD0.124, winXP. > > The following code prints "int()*". Shouldn't it be "int(int)*" ? > The same occurs on delegates too. Delegates and function pointer typeinfos presently include just their return value and no arguments. If you're trying to compare TypeInfos, then you need to use "is"; their opEquals is currently broken and will return equivalence between ANY function pointer, even with different return types. I sent fixes for that to Walter a few versions ago - I'm not sure what he's doing with them. > <code> > import std.stdio; > void main() > { > writefln(typeid(int function(int))); > } > </code> |
May 23, 2005 Re: Typeid for functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | In article <d6qkb0$2chg$1@digitaldaemon.com>, Burton Radons says... > >tetsuya wrote: > >> [snip] > >Delegates and function pointer typeinfos presently include just their return value and no arguments. > >If you're trying to compare TypeInfos, then you need to use "is"; their opEquals is currently broken and will return equivalence between ANY function pointer, even with different return types. I sent fixes for that to Walter a few versions ago - I'm not sure what he's doing with them. > >> [snip] Thanks. I'll keep that in mind. |
June 04, 2005 Re: Typeid for functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to tetsuya Attachments: | tetsuya wrote: | DMD0.124, winXP. | | The following code prints "int()*". Shouldn't it be "int(int)*" ? | The same occurs on delegates too. | | <code> | import std.stdio; | void main() | { | writefln(typeid(int function(int))); | } | </code> | Extended test cases: http://dstress.kuehne.cn/run/typeid_84.d http://dstress.kuehne.cn/run/typeid_85.d Thomas |
Copyright © 1999-2021 by the D Language Foundation