power-of-tenlisted
Install: claude install-skill ipapadop/plugins
# Power of Ten: safety-critical C and C++
Gerard J. Holzmann (NASA/JPL Laboratory for Reliable Software) proposed ten rules for safety-critical code. The rules are strict on purpose. Each one makes a property of the code provable by a tool: termination, bounded stack and memory, a known call graph, and a known data flow. Code that follows them can be checked mechanically, not only reviewed by hand. Apply them as written. When code can't comply, state the deviation and the reason in a comment at the site, so that a checker flags it and a reviewer can judge it.
The paper targets C. For C++, read [references/cpp.md](references/cpp.md) before you write or review code. It maps each rule to C++ features (exceptions, `new`, standard containers, virtual functions, `std::function`, templates). Those mappings are interpretations of this skill, not text from the paper; say so when you cite them.
## The rules
### 1. Simple control flow
Do not use `goto`, `setjmp`, `longjmp`, or direct or indirect recursion.
Without recursion the call graph is acyclic, so a tool can prove that execution is bounded and can compute the maximum stack depth. Early `return` for errors is allowed; the rule does not require a single exit point.
To remove recursion, use an explicit stack with a fixed capacity in static or caller-provided storage. When the stack is full, return an error. Do not grow it.
Look for indirect recursion too: `a()` calls `b()`, which calls `a()`. A function pointer or a callback