Terminology Flashcards
Static memory allocation
Memory is allocated at compile time
Static typing
Type checking is done at compile time. It is not necessary to define an object before it is used but you must have an explicit type declaration e.g. int num; num = 10; (C/C++, Java)
Dynamic typing
Type checking is done at run time. All variables must be defined before they are used. e.g. num = 10; (Python)
Aliasing
When two names or expressions refer to the same location e.g. no array bounds checking in C; “shallow” object copies
Formal parameters
The parameter names used in a function declaration
Actual parameters
When a function is called expressions called actual parameters are used to compute the parameter values for that call
Expressions
Syntactic entity that may be evaluated to determine its value
Statement
Command that alters the state of the machine in some explicit way
Declaration
Syntactic entity that introduces a new identifier
Static scope
Identifier refers to the declaration of that name that is declared in the closest enclosing scope of the program text e.g. const int b = 5; int foo() { int a = b + 5; return a; }
int bar() { int b = 2; return foo(); }
int main() { foo(); // returns 10 bar(); // returns 10 return 0; }
Dynamic scope
Global identifier refers to the declaration associated with the most recent environment e.g. const int b = 5; int foo() { int a = b + 5; return a; }
int bar() { int b = 2; return foo(); }
int main() { foo(); // returns 10 bar(); // returns 7 return 0; }
Abstract/virtual machine
An idealised device that can execute a programming language directly
Garbage collection
The process of detecting garbage (memory locations that are not available to the program) during the execution of a program and making it available
Call by value
Evaluate the expressions in the actual parameter list and pass the resulting values
Call by text
Transmit the expression in the actual parameter list as text so that the called function can evaluate them as needed using “eval”
L-value
Location of a variable