L
Lew Pitcher
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
When the code requires callback functions, function pointers are ideal.
Just think of how many different "sort" functions you'd have to write,
if sort() /didn't/ perform key comparison through a function pointer.
- --
Lew Pitcher, IT Specialist, Corporate Technology Solutions,
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEiDl4agVFX4UWr64RAr8rAJ4xqIMB529bJ7oa8a6EjwPPZnQOLACffvVQ
z2FCJiZ0dum1DbgI+IgjHtI=
=Mwp0
-----END PGP SIGNATURE-----
Hash: SHA1
Christian said:Hi,
in which situations pointers to functions might be more
efficient/convenient than a direct function call?
When the code requires callback functions, function pointers are ideal.
Just think of how many different "sort" functions you'd have to write,
if sort() /didn't/ perform key comparison through a function pointer.
In the example I've found so far, I see no advantage of
using pointers to functions. Rather the code is harder to
read.
- --
Lew Pitcher, IT Specialist, Corporate Technology Solutions,
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEiDl4agVFX4UWr64RAr8rAJ4xqIMB529bJ7oa8a6EjwPPZnQOLACffvVQ
z2FCJiZ0dum1DbgI+IgjHtI=
=Mwp0
-----END PGP SIGNATURE-----