▲ | lelanthran 4 hours ago | |
> C++ has lifetime rules just like Rust. They're simply implicit in the code and not enforced by the compiler. The problem is that the rules enforced by Rust is not restricted to lifetime rules, it's a much much larger superset that includes quite a lot of safe, legitimate and valid code. | ||
▲ | AlotOfReading 2 hours ago | parent | next [-] | |
Sure, but that's not a design philosophy C++ adheres to. Look at the modern C++ guidelines or profiles. The entire point is to rule out large swathes of safe, legitimate, and valid code in an optional and interoperable way. C++ isn't beholden to Rust's trade-offs either. There's a whole spectrum of possibilities that don't require broken backwards compatibility. Hence: "Why draw the line specifically at lifetime annotations?" | ||
▲ | PittleyDunkin 3 hours ago | parent | prev [-] | |
That's what the unsafe keyword is for. |