Thread overview
Typeid for functions
May 20, 2005
tetsuya
May 22, 2005
Burton Radons
May 23, 2005
tetsuya
Jun 04, 2005
Thomas Kühne
May 20, 2005
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
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
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
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