3 ms·
Without writing safe C you cannot write correct C. If your C is unsafe it is incorrect by definition.
by rowanG077 2y ago
Without writing safe C you cannot write correct C. If your C is unsafe it is incorrect by definition.
- deleted 2y ago[deleted]
- kazinator 2y agoThat is obviously untrue by the definition of unsafe that I've been explicitly using. I've been sticking with the concept of unsafe language, whereas you're talking about an unsafe program. The two are related. An unsafe program misbehaves when given bad inputs. It's behavior is undefined. An unsafe language is an unsafe program with regard to bad inputs, which consist of certain kinds of incorrect programs. (Those which are not diagnosed). It's easy to write unsafe programs in unsafe languages. If we only focus on the program's functional requirements and none of them speak about what to do with bad inputs or in bad situations, we can end up with a program which is perfectly correct but unsafe. It will behave as specified on the correct inputs. If you happen to be advocating Rust due to misunderstanding this kind of material, you're in it for the wrong reasons.