2 points · by hellofunk · 10y ago · 5 comments
Correctness is a static mathematical property of the source code.
Safety is a mechanical property of a program executing on hardware.
Correctness is absolute. Either it is a proof [or possible proof] or not.
Safety is relative. For a web application, it may mean handling javascript injection attempts. For a spacecraft it may mean handling random bit flips caused by cosmic radiation.
Caveat: I'm not dogmatic about any of this. I'm not trying to handle all corner cases. And fundamentally, I believe words mean what we mean when we use them; that meaning isn't fixed by external sources. I'm just answering the question to a degree somewhat commensurate with the effort put into asking it.
Safe: Correct and does not have unintended and undesirable side effects.
So, in my opinion being correct is a prerequisite for being safe.
I thought "safe" just meant it wouldn't ever crash or read or write to memory it shouldn't, and things like that, whereas correct means it meets some set of requirements exactly, and, because of this would probably also be safe.
Which, is kind of backwards from what cnvogel said, and I don't have any reason for expecting myself to be more correct, so,
I would suggest that you treat their comment to be more likely to be correct than mine.
But if they are wrong this is what I think the difference is.