Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by MatthiasPortzel on Wednesday June 28, 2023 @12:09PM
(#36508530)
By disallowing recursion and requiring loops to have a fixed upper bound, you’ve defined a subset of C that is less than Turning complete.
[ Parent
| on HN ]
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by jcranmer on Wednesday June 28, 2023 @12:29PM
(#36508833)
If you're being that pedantic, C itself is not Turing-complete in the first place: pointers have finite size, which means that C can address only a bounded amount of memory, so it is a finite state machine (just with an extremely large number of states).
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by tgv on Wednesday June 28, 2023 @12:59PM
(#36509256)
I don't think it's about that. Technically, everything is finite. But placing limits on the loops and restricting memory allocation bounds the complexity. It probably limits everything to P-time.
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by c_crank on Wednesday June 28, 2023 @01:13PM
(#36509437)
Bounding the complexity is desirable for a system that should never fail due to software errors.
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by adrianN on Wednesday June 28, 2023 @02:04PM
(#36510235)
You can easily have bounded loops and superexponential runtime.
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by tgv on Wednesday June 28, 2023 @04:15PM
(#36511957)
Without dynamic memory allocation? I think you'd need at least O(n) memory to store enough state to go exponential. But it's some time I did complexity theory; I could be wrong.
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by adrianN on Thursday June 29, 2023 @12:53AM
(#36516442)
Unless your input is read-only you should always have O(n) memory available.
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by l33t233372 on Wednesday June 28, 2023 @02:36PM
(#36510624)
When everything is finite and memory is always limited, what are you meaningfully saying about the possible behaviors of software here?
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by AnimalMuppet on Wednesday June 28, 2023 @12:34PM
(#36508895)
Yes. And by doing so (and by removing recursion), you are also making the Halting Problem decidable.
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by hedora on Wednesday June 28, 2023 @11:46PM
(#36516081)
Rule 5 prohibits programs that average less than two undecidable branches per function.
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by adrianN on Wednesday June 28, 2023 @12:56PM
(#36509209)
How many problems in safety critical systems need Turing completeness and how many are fine with something weaker eg primitive recursion? My intuition is that most things are fine without full Turing completeness (as far as you can even apply terms about computability to systems with complex IO behavior)
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by marcosdumay on Wednesday June 28, 2023 @04:35PM
(#36512233)
> How many problems in safety critical systems need Turing completeness
Probably all, like the ones outside of critical systems.
But if you concentrate the complex behavior in a single layer, you will probably get a very thin layer, that you can call an OS or something like that, verify it very well, and have almost all the code follow a non-complete idiom.
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by adrianN on Thursday June 29, 2023 @12:50AM
(#36516416)
I have worked on a safety critical system and can't recall a part that needed Turing completeness.
Re:The Power of 10: Rules for Developing Safety-Critical Cod...
by marcosdumay on Thursday June 29, 2023 @11:49AM
(#36522093)
What starts your safety critical code?