CDECL Utility
"Jérôme M. Berger"
jeberger at free.fr
Sun Dec 30 15:07:18 PST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jarrett Billingsley wrote:
> "jpl" <none at nospam.com> wrote in message
> news:fl8ftn$25o8$1 at digitalmars.com...
>
>>> So I think that the proper D declaration would be:
>>> void function (int sig, void function (int)) function (int) signal;
>>
>> Then the pointers to functions in D are not read from right to left?
> I think Jerome got it wrong too XD
>
> "declare signal as function (int, pointer to function (int) returning void)
> returning pointer to function (int) returning void" in D would be
>
> alias void function(int) signal(int, void function(void));
>
> Notice I used an alias and put signal in the middle, since the C is
> declaring a *function* and not a *function pointer*.
>
On second thought, I think you got it right, except that there
shouldn't be an alias here: it should simply be:
void function (int) signal (int, void (function (int));
The "alias" version would actually be equivalent to:
typedef void (*signal(int, void (*)(int)))(int);
Jerome
- --
+------------------------- Jerome M. BERGER ---------------------+
| mailto:jeberger at free.fr | ICQ: 238062172 |
| http://jeberger.free.fr/ | Jabber: jeberger at jabber.fr |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQFHeCSmd0kWM4JG3k8RAlz5AKCrezQ0toLki+0SrxGgVkw1imjQYQCfZwO7
o6doMlNQrIpMORuMAMIwgMc=
=LlDL
-----END PGP SIGNATURE-----
More information about the Digitalmars-d-learn
mailing list