display | more...
This pair of terms is used to describe the participants in a function call:
If routine A calls routine B then routine A is the caller and routine B is the callee. i.e. the caller is the routine which is calling the callee.
If this is obvious then you can leave now (grin).

Comments which I received when this writeup ended right here have made it clear that it isn't obvious to everyone.


Consider the following set of routines (in an imaginary programming language):

 1     routine alpha(n)
 2     print "n is ",n
 3     return
 4     end
 5
 6     routine beta()
 7     call alpha(12)
 8     return
 9     end
10
11     routine gamma()
12     call beta()
13     return
14     end
When gamma calls beta on line 12, gamma is the caller and beta is the callee. Later, when beta calls alpha on line 7, beta is the caller and alpha is the callee.

One key point is that for each call between routines, the routine that initiates the call is the caller and the routine that is being called is is the callee. i.e. beta is the callee when it is called by gamma but becomes the caller when it calls alpha.

If you want to see why these terms are worth defining, read about linkage conventions and ask yourself how you'd describe the concept of linkage conventions without these two terms or two other terms with equivalent meaning.

These terms aren't particularily useful outside of the realm of linkage conventions (or calling conventions).


argument vs parameter

There's another set of related terminology which is probably worth explaining here and that's the difference between a parameter and an argument. When a routine calls another routine, it may pass something to the other routine. From the perspective of the caller the thing which is passed is an argument. From the perspective of the routine that receives the call, i.e. the callee, the thing which is passed is a parameter. For example, in the above call on line 7, the argument 12 is passed by beta. Within alpha, the parameter n then gets an initial value of 12 (which is printed on line 2).

Unfortunately, the distinction between what an argument is and what a parameter is has faded over time. In fact, it has pretty much reached the point where most people aren't aware of the distinction between an argument and a parameter. The failure to maintain a clear distinction between these two terms often leads to confusion when two people are discussing some of the subtle points of parameter or argument passing. If the confusion becomes severe enough and it is in a context which matters then it can even lead to an argument about arguments and parameters (grin).

Log in or register to write something here or to contact authors.