The Power of 10: Rules for Developing Safety-Critical Code
||This article needs more links to other articles to help integrate it into the encyclopedia. (October 2012)|
The Power of 10 Rules were created in 2006 by Gerard J. Holzmann of the NASA/JPL Laboratory for Reliable Software. The rules are intended to eliminate certain C++ coding practices which make code difficult to review or statistically analyze. These rules are a complement to the MISRA C guidelines and have been incorporated into the greater set of JPL coding standards.
The ten rules are:
- Avoid complex flow constructs, such as goto and recursion.
- All loops must have fixed bounds. This prevents runaway code.
- Avoid heap memory allocation.
- Restrict functions to a single printed page.
- Use a minimum of two runtime assertions per function.
- Restrict the scope of data to the smallest possible.
- Check the return value of all non-void functions, or cast to void to indicate the return value is useless.
- Use the preprocessor sparingly.
- Limit pointer use to a single dereference, and do not use function pointers.
- Compile with all possible warnings active; all warnings should then be addressed before release of the software.
- The Power of 10: Rules for Developing Safety-Critical Code
- JPL C Coding Standard - JPL Laboratory for Reliable Software
- Unintended Acceleration and Other Embedded Software Bugs, March 1st, 2011, by Michael Barr, Embedded Gurus
- NASA Engineering and Safety Center Technical Assessment Report, National Highway Traffic Safety Administration Toyota Unintended Acceleration Investigation, Appendix A