Kaz Kylheku <firstname.lastname@example.org> wrote:
| Rob Warnock <email@example.com> wrote:
| > $ ./ctest
| > 17003
| > $
| > I've been playing these sorts of games for years, with great success! ;-}
| Who's winning today, and what is the score?
Seriously, having even ad-hoc closures in my "C toolbox" has been
a big win for me.
- There are some standard C library functions that are a lot less
convenient if you *don't* have them [e.g., the "ftw(3)/nftw(3)"
file tree walkers come to mind, or the "twalk(3)" library].
- It makes writing your own polymorphic/generic higher-order functions
- It makes writing GUI event callback functions easier.
Yes, you can fake it by requiring all your higher-order functions
to take both a "callback" function pointer and an opaque cookie
(which is passed to the "callback"), but you can't depend on all
the library functions you want to use doing this.
Rob Warnock <firstname.lastname@example.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607