4 ms·
More like they were using C, saw the prospect of unbounded stack calls unreasonable with a computer with limited ram and banned recursion. Oh wait that's exactl
by throwaway344534 8y ago
More like they were using C, saw the prospect of unbounded stack calls unreasonable with a computer with limited ram and banned recursion. Oh wait that's exactly what happened because iteration is safer than recursion.
- dahart 8y agoIteration is not inherently safer than recursion. NASA also banned while(true) iteration. The important part is "fixed upper bounds". "Give all loops a fixed upper bound. It must be trivially possible for a checking tool to prove statically that the loop cannot exceed a preset upper bound on the number of iterations. If a tool cannot prove the loop bound statically, the rule is considered violated." https://pdfs.semanticscholar.org/ad40/26510beb1a30990270458387e769e216dca3.pdf https://pdfs.semanticscholar.org/ad40/26510beb1a309902704583...
- monocasa 8y agoThe static analysis tools have a harder time parsing the upper bounds on recursive functions, and so do the engineers doing the code reviews for similar reasons. This isn't just a NASA thing. Pretty much any embedded coding standard says the same thing. The JSF C++ standard, and MISRA-C I know both do as well, just off the top of my head.