www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Typeid for functions

reply tetsuya <tetsuya_member pathlink.com> writes:
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 20 2005
next sibling parent reply Burton Radons <burton-radons smocky.com> writes:
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 22 2005
parent tetsuya <tetsuya_member pathlink.com> writes:
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.
May 23 2005
prev sibling parent =?ISO-8859-1?Q?Thomas_K=FChne?= <thomas-dloop kuehne.THISISSPAM.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCoed23w+/yD4P9tIRAtQGAKC3LKseEpc2GOhrhawOQz4Xpk2xiwCeM9Uz
v8Dn2ExqvKOzJM/w55DF7w4=
=PQG7
-----END PGP SIGNATURE-----
Jun 04 2005