|
ABSTRACT
This paper presents CMod, a novel tool that provides a sound module system for C. CMod works by enforcing a set of four rules that are based on principles of modular reasoning and on current programming practice. CMod's rules flesh out the convention that .h header files are module interfaces and .c source files are module implementations. Although this convention is well-known, developing CMod's rules revealed there are many subtleties in applying the basic pattern correctly. We have proven formally that CMod's rules enforce both information hiding and type-safe linking. We evaluated CMod on a number of benchmarks, and found that most programs obey CMod's rules, or can be made to with minimal effort, while rule violations reveal brittle coding practices including numerous information hiding violations and occasional type errors.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
 |
1
|
|
| |
2
|
L. Cannon, R. Elliott, L. Kirchoff, J. Miller, R. Mitze, E. Schan, N. Whittington, H. Spencer, D. Keppel, and M. Brader. Recommended C Style and Coding Standards. sixth edition, 1990.
|
| |
3
|
COM: Component object model technologies. http://www.microsoft.com/com/default.mspx.
|
| |
4
|
|
| |
5
|
Exhuberant ctags. http://ctags.sourceforge.net/.
|
| |
6
|
|
| |
7
|
J.-M. Favre. CPP Denotational Semantics. In SCAM, 2003.
|
 |
8
|
|
| |
9
|
|
| |
10
|
Once-only headers - the C preprocessor. gcc on-line documentation, section 2.4, http://gcc.gnu.org/onlinedocs/gcc-4.1.1/cpp/Once_002dOnly-Headers.html.
|
| |
11
|
Trevor Jim , J. Greg Morrisett , Dan Grossman , Michael W. Hicks , James Cheney , Yanling Wang, Cyclone: A Safe Dialect of C, Proceedings of the General Track: 2002 USENIX Annual Technical Conference, p.275-288, June 10-15, 2002
|
| |
12
|
S. Johnson. Lint, a C program checker. Technical Report 65, Bell Labs, Murray Hill, N.J., Sept. 1977.
|
| |
13
|
|
| |
14
|
|
| |
15
|
|
 |
16
|
|
| |
17
|
S. McConnell. Code Complete. Microsoft Press, 1993.
|
 |
18
|
|
 |
19
|
Robert Morris , Eddie Kohler , John Jannotti , M. Frans Kaashoek, The Click modular router, Proceedings of the seventeenth ACM symposium on Operating systems principles, p.217-231, December 12-15, 1999, Charleston, South Carolina, United States
|
| |
20
|
G. Morrisett. Personal communication, July 2006.
|
 |
21
|
|
| |
22
|
|
 |
23
|
|
| |
24
|
PC-lint/FlexeLint. http://www.gimpel.com/lintinfo.htm, 1999. Product of Gimpel Software.
|
| |
25
|
|
| |
26
|
A. Reid, M. Flatt, L. Stoller, J. Lepreau, and E. Eide. Knit: Component composition for systems software. In OSDI, 2000.
|
| |
27
|
J. C. Reynolds. Types, abstractions and parametric polymorphism. Information Processing 83, pages 513--523.
|
| |
28
|
D. Spuler and A. Sajeev. Static detection of preprocessor macro errors in C. Technical Report 92/7, James Cook University, Australia, '92.
|
| |
29
|
S. Srivastava, M. Hicks, J. S. Foster, and B. Kanagal. Defining and Enforcing C's Module System. Technical Report CS-TR-4816, University of Maryland, College Park, 2006.
|
| |
30
|
W. P. Stevens, G. J. Myers, and L. L. Constantine. Structured design. IBM Systems Journal, 13(2):115--139, 1974.
|
| |
31
|
R. van Ommering, F. van der Linden, J. Kramer, and J. Magee. The Koala component model for consumer electronics software. IEEE Software, 2000.
|
CITED BY 2
|
|
|
|
|
Jeffrey S. Foster , Michael W. Hicks , William Pugh, Improving software quality with static analysis, Proceedings of the 7th ACM SIGPLAN-SIGSOFT workshop on Program analysis for software tools and engineering, p.83-84, June 13-14, 2007, San Diego, California, USA
|
|