Automatic variable in the context of ALGOL


Automatic variable in the context of ALGOL

Automatic variable Study page number 1 of 1

Play TriviaQuestions Online!

or

Skip to study material about Automatic variable in the context of "ALGOL"


⭐ Core Definition: Automatic variable

In computer programming, an automatic variable is a local variable which is allocated and deallocated automatically when program flow enters and leaves the variable's scope. The scope is the lexical context, particularly the function or block in which a variable is defined. Local data is typically (in most languages) invisible outside the function or lexical context where it is defined. Local data is also invisible and inaccessible to a called function, but is not deallocated, coming back in scope as the execution thread returns to the caller.

Automatic local variables primarily applies to recursive lexically scoped languages. Automatic local variables are normally allocated in the stack frame of the procedure in which they are declared. This was originally done to achieve re-entrancy and allowing recursion, a consideration that still applies today. The concept of automatic variables in recursive (and nested) functions in a lexically scoped language was introduced to the wider audience with ALGOL in the late 1950s, and further popularized by its many descendants.

↓ Menu
HINT:

In this Dossier

Automatic variable in the context of Register allocation

In compiler optimization, register allocation is the process of assigning local automatic variables and expression results to a limited number of processor registers.

Register allocation can happen over a basic block (local register allocation), over a whole function/procedure (global register allocation), or across function boundaries traversed via call-graph (interprocedural register allocation). When done per function/procedure the calling convention may require insertion of save/restore around each call-site.

View the full Wikipedia page for Register allocation
↑ Return to Menu