Unformatted text preview: variables Return address (i.e., where to resume when the function exits)
x This data is placed on the stack Special memory region in computers, to handle functions Stack has limited size by default (a few MB on linux)
x Each time a function is called, some space on the stack is
used Recursive functions may go over the stack size! 64 The (memory) life of a function
x A function can modify its own state (local variables /
x A function can modify global variables
x A function in C++ can read/write any memory address in
function the address space of the program!
x A function has side-effect when it modifies data outside
function the function (global variable, random memory, …)
x Otherwise, it is side-effect free / “pure” 65 Libraries
x Libraries are roughly packages of functions
x In a nutshell: someone else wrote functions, which are
In accessible to the developer of a new application
accessible Do not reprogram the wheel!
x Needed: The code (source, object)
View Full Document
This note was uploaded on 04/03/2014 for the course CS 31 taught by Professor Melkanoff during the Fall '00 term at UCLA.
- Fall '00