The Power of 10: Rules for Developing Safety-Critical Code

The Power of 10 Rules were created in 2006 by Gerard J. Holzmann of the NASA/JPL Laboratory for Reliable Software.[1] The rules are intended to eliminate certain C coding practices which make code difficult to review or statically analyze. These rules are a complement to the MISRA C guidelines and have been incorporated into the greater set of JPL coding standards.[2]

Rules

The ten rules are:[1]

  1. Avoid complex flow constructs, such as goto and recursion.
  2. All loops must have fixed bounds. This prevents runaway code.
  3. Avoid heap memory allocation.
  4. Restrict functions to a single printed page.
  5. Use a minimum of two runtime assertions per function.
  6. Restrict the scope of data to the smallest possible.
  7. Check the return value of all non-void functions, or cast to void to indicate the return value is useless.
  8. Use the preprocessor sparingly.
  9. Limit pointer use to a single dereference, and do not use function pointers.
  10. Compile with all possible warnings active; all warnings should then be addressed before release of the software.

Uses

The NASA study of the Toyota Electronic throttle control firmware found at least 243 violations of these rules.[3][4]

gollark: You do realise that it *can* be used to do stuff other than what they *say* it's being used for, yes?
gollark: Microsoft probably collects installed applications, maybe typing data, sort of thing, and Google collects search history.
gollark: But, er, you seem to have said that Google randomly collects microphone input? That's... quite significant?
gollark: Oh, I assumed you meant a literal national border.
gollark: You seem to recognize to some extent that other people having sensitive/personal data is *bad*, but not actually acknowledge the fact that Microsoft and Google... contain people, and might be passing that data onto people, and are retaining it for ages and it might go somewhere else eventually.

See also

Further reading

  • G.J. Holzmann (2006-06-19). "The Power of 10: Rules for Developing Safety-Critical Code". IEEE Computer. 39 (6): 9599. doi:10.1109/MC.2006.212.

References

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.