CSC161 2010F Imperative Problem Solving
[Skip to Body]
Primary:
[Front Door]
[Schedule]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
-
[Assignment]
[Lab]
Groupings:
[EBoards]
[Assignments]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
assert
Back to Interactive Testing. On to Debugging with DDD.
This outline is also available in PDF.
Held: Monday, 11 October 2010
Summary:
We consider issues of program correctness and ways in which
C's assert
macro can help.
Related Pages:
Design by Contract.
Notes:
http://www.gnu.org/manual/ddd/
.Overview:
assert
.Because we focus on preconditions and postconditions in 151, you may not have found much new in the reading.
Still, it is useful to keep a number of things in mind.
One then has the question of how to deal with preconditions and postconditions.
What should you do if a precondition is not met?
Additional notes
assert
assert
statement to help you deal with many
of these issues.
assert (expression)
checks if expression
fails. If so, assert
prints an error message and terminates
the program.
assert
helps us catch errors early in a program. (One
great thing about C is that many errors pass through, screw something else
up, and it's really hard to find out the first place that something went
wrong.)
Back to Interactive Testing. On to Debugging with DDD.
[Skip to Body]
Primary:
[Front Door]
[Schedule]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
-
[Assignment]
[Lab]
Groupings:
[EBoards]
[Assignments]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Wed Dec 8 10:57:09 2010.
The source to the document was last modified on Fri Aug 13 15:41:46 2010.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CSC161/2010F/Outlines/outline.26.html
.