cs31 lecture 17

X needed the code source object implementing the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

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 Each used 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 / function arguments)
 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! the x A function has side-effect when it modifies data outside function the function (global variable, random memory, …)
 the 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

{[ snackBarMessage ]}

Ask a homework question - tutors are online