Class Notes (810,422)
Canada (494,121)
CS 138 (14)
Lecture 11

Data Lecture 11.docx

3 Pages
Unlock Document

University of Waterloo
Computer Science
CS 138
Michael Godfrey

Data Lecture 11 February 12, 2013 Mid-term Notes  REVIEW UNIX FILE PERMISSIONS  Reference parameters are used on midterm  i=(i+1)%n o Modular arithmetic Comments on Pointers & Defensive Programming  With pointers, it’s easy to make subtle & hard-to-find mistakes that you discover much later in program execution (or not at all)  Friends you need to get to know: o Drawing diagrams o A good debugger o Assertions & print statements & judicious commenting  When diagnostic print statement?  At beginning/end of function call  Just after creating something “now”  Just before deleting something  At major decision point  Any time you do something interesting  When to assert?  Check that logic/assumptions are correct o q.last==NULL if q.first==NULL  Check that “client” is being reasonable o Check queue is non-empty before allowing pop Reference Parameters  C and Java support only call-by-value o I.e. create a copy of calling parameter in the activation record (AR) of the procedure on the run-time stack o Changes made to copies do not percolate back to calling environment  Parameter storage disappears when function call ends and AR is popped off the stack o Can change v
More Less

Related notes for CS 138

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.