Lightning Talk: Rust Without ‘Unsafe’ Is as Unsafe as C++ - Pavel Novikov - C++Online 2024
ฝัง
- เผยแพร่เมื่อ 18 ต.ค. 2024
- The Online C++ Conference - cpponline.uk/ -- @cpponlineconf
---
Lightning Talk: Rust Without ‘Unsafe’ Is as Unsafe as C++ - Pavel Novikov - C++Online 2024
Rust allows to shoot yourself in the foot as well, although not as easily, apparently as everything is harder to do in Rust.
Slides: github.com/Cpp...
---
Pavel Novikov
Got an engineering degree in missilery from BMSTU (Moscow).
Loves C++ and knows how to cook it.
Likes metaprogramming, multithreading and asynchronous programming, coroutine adoption enthusiast.
---
Streamed & Edited by Digital Medium Ltd - online.digital-medium.co.uk
---
C++Online - The Online C++ Conference organized by Shaved Yaks: shavedyaks.com/ & Digital Medium: events.digital...
---
#cpp #cplusplus #cpponline #rust
I think it's worth being clear about a couple things. 1) This bug will definitely be fixed eventually. It's slightly embarrassing that it's been open for so long, but part of the reason for that is that 2) it's almost impossible to accidentally trigger this bug. The copy-pasted code is quite hard to follow, and I wouldn't be able to reproduce it from memory even if you paid me to try :) In contrast of course, the same mistake in C++ is one we all make the first week we learn about pointers.
Before that eventually happens C++ compilers might finally get warnings/errors and static analysis for most dangling cases.
C is "trust the developer" model, while Rust is "trust the compiler". Only the former results in auditable code. The latter means the code's validity depends on the compiler's version, which is all but a safe practice!
What?? Are you telling us Rust is not auditable? 😂
Why hasn't clang a warning for this simple dangling cases? It would be on par with rust "safety" and help sometimes.