4 ms·
A panic is memory-safe, so static checking of memory safety holds. Perhaps you should understand your own claims.
by unrealhoang 11mo ago
A panic is memory-safe, so static checking of memory safety holds. Perhaps you should understand your own claims.
- bgwalter 11mo agoI'll henceforth refer to the process of using vector.at(0) instead of vector[0] in C++ as "providing memory safety by static analysis". Static analysis has a specific meaning, and rote insertion of bounds checking isn't it.
- unrealhoang 11mo agoMemory safety has a specific meaning, and panic isn’t it. C++ can have UB, compilable non-unsafe Rust can’t, that’s what static analysis of memory safety is. Main point here is you don’t know (and refuse to learn) new knowledge.
- bgwalter 11mo ago[flagged]
- estebank 11mo agoIf the only way of triggering spatial memory unsafety in C++ was vector[i] and that operation was defined to always interrupt execution, then yes, C++ would be considered memory safe. But that is not the case. The equivalent of vector[i] in Rust is Vex::get_unchecked, which is marked as unsafe, not the default that people reach for normally.
- bgwalter 11mo agoWe are, however, talking in this subthread about the compiler inserting bounds checks and (incorrectly) calling the process "static checking". I refuted that point by pointing out that the same process, if done manually in C++, would not be considered "static analysis that provides memory safety for array access".