What exactly is "Binding Time?"

What do we mean by "Binding Time?" And what does it have to do with recursion? I have no knowledge on this binding time statement, can anyone explain?
Last edited on
AFAIK. It's at which stage of the application's life does the binding occur. During compilation, language design etc.

It's not a very common term and tbh I've never heard it being used in the real world :P
We can use a name (or identifier) to refer to an entity. For instance, if we write:

1
2
3
4
5
6
7
8
#include <cstring>

const char my_c_string[] = "abcd" ;

int main()
{
      return std::strlen( my_c_string ) ;
}


In std::strlen( cstr ) ;, we are using two names - the name std::strlen and the name my_c_string. The process of association of specific entities with names is called 'binding' or 'name binding'.

In the above example, the name std::strlen when bound refers to a particular function, and the name my_c_string is bound to refer to an object (an array of const chars).

If this binding is done before the program actually starts running (as in the above two cases), the binding is said to be 'static' or 'early'. If the binding is done after the program starts running (typically each time the name is encountered), the binding is said to be 'dynamic' or 'late'.


> what does it have to do with recursion?

Nothing very special. In recursion 101, a function calls itself by using the name of the very same function; and the name binding for the recursive call is done early, at compile-time.
Topic archived. No new replies allowed.