In the July 2006 IEEE Computer Journal article: “The Power of 10: Rules for Developing Safety- Critical Code” by Gerard J. Holzmann of the NASA/JPL Laboratory for Reliable Software, the following 10 rules were listed:
- Restrict all code to very simple control flow constructs—do not use go to statements, set jump or long jump constructs, or direct or indirect recursion.
- Give all loops a fixed upper bound.
- Do not use dynamic memory allocation after initialization.
- No function should be longer than what can be printed on a single sheet of paper in a standard format with one line per statement and one line per declaration.
- The code’s assertion density should average to minimally two assertions per function.
- Declare all data objects at the smallest possible level of scope.
- Each calling function must check the return value of non void functions, and each called function must check the validity of all parameters provided by the caller.
- The use of the pre-processor must be limited to the inclusion of header files and simple macro definitions. Token pasting, variable argument lists (ellipses), and recursive macro calls are not allowed. All macros must expand into complete syntactic units. The use of conditional compilation directives must be kept to a minimum.
- The use of pointers must be restricted. Specifically, no more than one level of de-referencing should be used. Pointer de-reference operations may not be hidden in macro definitions or inside typedef declarations. Function pointers are not permitted.
- All code must be compiled, from the first day of development, with all compiler warnings enabled at the most pedantic setting available. All code must compile without warnings. All code must also be checked daily with at least one, but preferably more than one, strong static source code analyzer and should pass all analyses with zero warnings.