Contents Introduction Names Variables The Concept of Binding Type Checking Strong Typing Type Equivalence Scope Scope and Lifetime Referencing Environments Named Constants Introduction


(3)Explicit heap-dynamic variables: are nameless (abstract) memory cells that are allocated and deallocated by explicit directives, specified by the programmer, which take effect during execution



Download 396.24 Kb.
Page9/16
Date18.02.2022
Size396.24 Kb.
#58269
1   ...   5   6   7   8   9   10   11   12   ...   16
13516098

(3)Explicit heap-dynamic variables: are nameless (abstract) memory cells that are allocated and deallocated by explicit directives, specified by the programmer, which take effect during execution.

  • Referenced only through pointers or references, e.g. dynamic objects in C++ (via new and delete), all objects in Java.
  • C: int *intptr;
  • intptr = (int *) malloc(1 * sizeof(int));

    free(intptr);

  • Advantage: high flexibility (provides for dynamic storage management)
  • Disadvantage: inefficient and unreliable.
  • lifetime = from explicit allocation to explicit deallocation.

Download 396.24 Kb.

Share with your friends:
1   ...   5   6   7   8   9   10   11   12   ...   16




The database is protected by copyright ©ininet.org 2024
send message

    Main page