Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: First Chess Program

Author: Dann Corbit

Date: 14:59:55 11/26/01

Go up one level in this thread


On November 26, 2001 at 17:32:42, Russell Reagan wrote:

>On November 26, 2001 at 15:05:23, Dann Corbit wrote:
>
>>Gerbil is an interesting open source beginning program written in C++.  It has
>>extensive use of callback functions.
>
>What is a callback function?

A callback function is often an installed handler function of some kind.

A classic example that is easy to understand is the compare function for the
qsort() C standard library routine.

A special case are interrupt routines installed by the signal handler functions.

Much of the time, you will find asynchronous routines use handler functions, as
do many state machines.  They are a useful technique to learn.

It boils down to this:
You have a function which takes as one of its arguments a pointer to function.
When you call that function, you give it the address of the function you want to
use.  Then, internally, the function you passed gets used.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.