4 ms·
> adds lifetime annotations and unsafe blocks Worth noting that the vast majority of lifetime annotations in Rust are “elided”, i.e. inferred by the compiler.
by DougBTX 6y ago
> adds lifetime annotations and unsafe blocks
Worth noting that the vast majority of lifetime annotations in Rust are “elided”, i.e. inferred by the compiler.
I’d say that a successful “safe C” compiler would accept any existing C code that never invokes undefined behaviour, without a runtime performance penalty.
- nicoburns 6y ago> I’d say that a successful “safe C” compiler would accept any existing C code that never invokes undefined behaviour, without a runtime performance penalty. That's unfortunately what's not possible. The C source code doesn't contain enough information to prove safety (a lot of real world C code depends on invariants that happen to be true at runtime, but aren't provably true at compile time)
- DougBTX 6y agoYes, it probably is impossible. On the other hand, C programmers are asked to write code which doesn't invoke undefined behaviour otherwise their code can break in unpredictable ways, so either we just don't have sufficiently good checking algorithms yet or it is impossible for them too.