np hard
2006 United States meta
15

The Power of 10 — Rules for Safety-Critical Code

Gerard Holzmann, NASA/JPL, 2006 — ten coding rules that make C statically analyzable. Discipline as gravity.

Gerard Holzmann, at the NASA Jet Propulsion Laboratory Laboratory for Reliable Software, distilled four decades of safety-critical software experience into ten coding rules for C. Restrict control flow to simple constructs (no goto, no recursion, no setjmp/longjmp). Bound every loop with a fixed upper limit a static analyzer can verify. No dynamic memory allocation after initialization. No function longer than a single printed page. At least two assertions per function. Restrict scope of data to the smallest reasonable. Check return values of all non-void functions or explicitly cast to void. Limit preprocessor use. Restrict pointer indirection to one level; no function pointers. Compile with all warnings enabled, treat as errors, run multiple static analyzers. The rules are restrictive enough that any C program following them is amenable to formal analysis, and lax enough that real flight software is written in them. The rules of the road for code that flies.

Holzmann, G. J. (2006). The Power of 10: Rules for Developing Safety-Critical Code. IEEE Computer, 39(6), 95–99. Source →