[Skip Navigation] [CSUSB] / [CNS] / [Comp Sci & Eng] / [R J Botting] /[CS320 Course Materials] /12.html [12.txt(Text)] [Search ]
Tue Apr 13 07:48:20 PDT 2010
[Schedule] [Syllabi] [Text] [Labs] [Projects] [Resources] [Grading] [Contact]
Notes: [01] [02] [03] [04] [05] [06] [07] [08] [09] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]

Contents


    CS320/12 Implementing Subprograms (Chapter 10)


      Table
      Prev 11LISPChapter 2 section 4 + LISP handoutlab11 LISP101
      12Implementing subprogramsChapter 10lab12 LISP102
      Next 13Functional ProgrammingChapter 15 not section 8lab13 LISP103

      (Close Table)

      Preparation

      Study the Notes below.

      Sudy Chapter 10.

      Think about the Notes and the reading.

      Answer the chapter's review questions.

      Hand in answers to 2 or more review questions.

      Notes

        (1) You need to describe the activation records for several kinds of language.

        (2) You need to describe the activation records for several kinds of language using the UML.

        (3) Variables declared in a C program can be global - visible to all parts of the program, or local to a file (static external), or be local to a particular block. A subprogram can only be local to a file or global. So, functions are never declared inside another function and so the referencing environment of functions can never contain variables that are local to other functions. This means that the compiler does not need to keep track of them. It lets the linker handle global variables and functions. So C has simpler Activation Records than Algol or Pascal.

        (4) In nearly all modern languages data is stored in two places: the stack and the heap The data on the stack is created (pushed) and deleted(popped) automatically as the blocks and subprograms are entered and exitted, respectively. However, data on the heap is created by special explicit operators like the "new" operator in Java and C++. It continues to exist after the subprogram or block in which it was created terminates. It is accessed indirectly by a pointer. If all the pointers to a piece of heap data are deleted then the data becomes garbage -- it takes up space that can be recycled. Java automatically collects the garbage and lets the program reuse the memory space. C++ does not -- and the programmer must do it themselves.

      Class Work

      [ 12q.html ]

      Lab Work -- More LISP

      [ lab/12.html ]

      Next -- Functional Programming

      [ 13.html ]

    End