scispace - formally typeset
Search or ask a question

Showing papers by "Saurabh Srivastava published in 2007"


Proceedings ArticleDOI
16 Jan 2007
TL;DR: It is concluded that CMod can effectively support modular programming in C: it soundly enforces type-safe linking and information-hiding while being largely compatible with existing practice.
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.

12 citations


30 Jun 2007
TL;DR: It is concluded that CMod can effectively support modular programming in C: it soundly enforces type-safe linking and information-hiding while being largely compatible with existing practice.
Abstract: In this section we show that our rules from Figure 2 are sound for MTAL0, assuming no type abstraction or type naming is present. We begin by stating some lemmas about MTAL0 (Figure 4). Lemma 2.1 (Preservation) If ` O1 link O2 ; O then ` O Lemma 2.2 (Associativity of link) If ` (O1 link O2) link O3 ; O then ` O1 link (O2 link O3) ; O. Lemma 2.3 (Commutativity of link) If ` O1 link O2 ; O then ` O2 link O1 ; O. Lemma 2.4 If ∀i, j, 1 ≤ i, j ≤ n, i 6= j . ` Oi link Oj ; Oij and if π is any permutation of {1 . . . n} then ` Oπ(1) link Oπ(2) link . . . link Oπ(n) ; O1...n with ` O1...n.

3 citations