Miguel A. Ballicora wrote:Dann Corbit wrote:I am sure I left out a lot of them (I have several hundred source codes, though many of them are not publicly available), but all of these are good learning tools:
- Code: Select all
gerbil {simple -- interesting callback idea that nobody else does}
Hi Dann, what do you mean exactly by this idea? I am fond of using pointer to functions in several places. Either I am doing something similar or I may like to borrow it from now on
Miguel
It's actually a very good idea. When I say that nobody is using it, I mean that hardly anyone uses it to drive the interface. Of course, people call qsort() with a compare function and things like that. There are even a few instances I have seen with replaceable functions for evaluation and search (championed by Earnst Heinz, IIRC).
Looking at the ancient stuff in my gav folder, I see:
BUILD_TH_FUNC
movegenfunc_t
mc_compfunc_t
pickfunction_t
and xb_func from xboard_command
so your code is definitely way above average in this regard.
I guess that if done right, it will be the most efficent way to do many of the things that are often done with timers and alarms in other programs.