
• Allocated and de-allocated by explicit directives, specified by the programmer,
which take effect during execution
• Referenced only through pointers or references
• Examples
– Dynamic objects in C++ (via new and delete)
– All objects in Java
• Advantage
– Provide dynamic storage management
• Disadvantage
– Inefficient and unreliable
Implicit Heap Dynamic Variables
• Allocation and de-allocation is caused by assignment statements
• Example
– All variables in Snobol
• Advantage
– Flexibility
• Disadvantages
– Inefficient, because all attributes are dynamic
– Loss of error detection
Modern Programming Languages
Lecture # 41
Type Checking
• Generalizes the concept of operands and operators to include subprograms
and assignments
• Type checking is the activity of ensuring that the operands of an operator are
of compatible types
• A compatible type is one that is either legal for the operator, or is allowed
under language rules to be implicitly converted, by compiler generated code, to
a legal type. This automatic conversion is called coercion
• A type error is the application of an operator to an operand of an inappropriate