| CSC 201 | Grinnell College | Spring, 2005 |
| Data Representation, Memory Management, and Formal Methods | ||
This lab provides some preliminary practice with the splint static-checking program.
The main reference for splint may found at http://www.splint.org. In particular, you will want to consult the the on-line Splint Manual.
At the start of the semester, we reviewed some basic elements of C programming through:
Henry Walker, An Introduction to C Through Annotated Examples, http://www.cs.grinnell.edu/~walker/c/index.html
Within that presentation, Program 14 ~walker/c/examples/trap-4.c shows the Trapezoidal Rule to illustrate several elements of C-style conditionals, loops, and functions.
Copy ~walker/c/examples/trap-4.c, compile and run it, and then review the code to remind yourself how it works.
Run splint on this program with the command
splint trap-4.c
and copy the resulting output to an editor.
Explain what is meant by the various warnings that are generated.
(When the same warning is given in several places, you may group the
multiple occurrences together with a single explanation.)
Modify trap-4.c to produce a program trap-4-rev.c that performs exactly the same computation, but so that at least 4 warnings are resolved (including at least 2 different types of warnings).
Within this course, several labs provided practice with singly-linked lists. For example, the first of these was a Laboratory Exercise on Singly-Linked Lists. Within that lab, the program namelist.c provided a simple driver for work that followed.
Copy ~walker/c/lists/namelist.c to your account, and run splint on it.
splint produces several (many) warnings, some of which you have already seen from the first part of this lab. In what follows, you should focus on new warnings that might be found.
Choose a program of yours that completes one of the following:
Use splint on your program, giving a full listing of any warnings generated.
This document is available on the World Wide Web as
http://www.cs.grinnell.edu/~walker/courses/201.sp05/labs/lab-static-checking.shtml
|
created 21 January 2005 last revised 8 May 2005 |
|
| For more information, please contact Henry M. Walker at walker@cs.grinnell.edu. |