In certain programming languages, the meaning of certain names may be fully determined at compile-time (i.e. without running the program).


A function in C has global scope; when the name of the function is used somewhere else in the program (and the variable is not shaded by another variable of the same name) it is always exactly that function that is being referenced, and the compiler can just inline the memory-address of that function.

What is the general term for such symbols of which the meaning is known fully at compile-time? I am tempted to go with "static", but that term seems to be mean very many things in different contexts. Is there a more unambiguous term for this phenomenon?

  • 1
    "Static" is a term which gets used for about a million different things, unfortunately, but I think the PLT version of static is what you're looking for. Something which can be determined at compile time can be said to be statically determined. – Phoshi Dec 7 '16 at 11:18

You're looking for “static”, as in “statically linked”, “statically dispatched”, or “statically resolved”. The term static just means that something can be done at compile time, in contrast to run time (where we'd talk about dynamic linking/dispatching/resolution/binding).

Some languages derive additional meanings for static from this primary meaning:

  • static variable lifetime in C and C++: The storage can be allocated at compile time, in contrast to automatic variables that are allocated on the stack, and instance members that are allocated as part of the enclosing object.

  • static methods in mainstream OOP languages: may be methods that do not use dynamic dispatch, or free functions inside a class namespace. Here, “static” is used in the sense “not dynamic” and “not belonging to an object”.


Static methods

is what came to mind when reading the title.
Reading the content confirmed it as you yourself noted.

  • In the case of classes/objects, the term is indeed static methods AFAIK (thanks for the example). However, my question is about "one level of generality higher". In other words: static methods are an example/instance of ...... in the context of classes/objects, where the answer to my question goes on the dots – Klaas van Schelven Dec 7 '16 at 11:19

The term is called Compile Time Function Evaluation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.