Rust NYC: Jon Gjengset - Demystifying unsafe code
Channel:Rust Programming Language · Length:29:24 · Published:2020-03-10 · Views:26887
Summary
Jon Gjengset's Rust NYC talk explaining what `unsafe` in Rust actually means, why it is dangerous, and why it is sometimes necessary. He works through the Rustonomicon to separate fair concerns from overblown ones.
Why HN recommends it
HN recommends it as the best calm explanation of unsafe Rust, from a speaker commenters trust on the topic.
There's a great new talk by on Gjengset on youtube that tackles just this question — HN, 2020
C, C++, Rust, Go & systems languages · Security & hacking
Subtitles (excerpt)
Uh, so my name is John for those of you who don't already know me from one medium or another. Um, so one thing I keep observing about the Rust community is how we're all like allergic to unsafe code or we think that unsafe code is just totally fine and not nothing to worry about. Um, and I wanted to take a little bit of time to talk about what unsafe is because I think a lot of where the community's um, lack of alignment on this particular topic comes from a fact that unsafe is a bit of a mystery to many of us. And I think I want to solve that problem. Um I'm not of the illusion that I can solve this problem in like 25 minutes, but I will try. Um so in this talk I'm going to try to demystify unsafe. I'm not going to teach you how to write correct unsafe code, but I am going to try to explain some of the reasons why you might actually want unsafe and some of the reasons why you should be careful about unsafe. And it is not something you should use sort of willy-nilly. Um, you could also sum up the the this talk basically as it's just C versus its certain doom. Um, neither of these extremes are correct. And it's very important that we all agree on this. Like writing unsafe is not just writing C code.
On Hacker News
While I might agree that it's easy if you use a reference counter, this is not going to be as performant as the typical linked list written in C, which is why the standard library uses unsafe for its implementation of stuff like this. If it were "easy" to just write correct `unsafe`, then it would be easy to do it in C as well. Note that the converse to this isn't necessarily true! People I trust… — saghm, 2024-12
There's a great new talk by on Gjengset on youtube that tackles just this question: Rust NYC: Jon Gjengset - Demystifying unsafe code [VIDEO] — Sammi, 2020-04
The rustnomicon is a very good resource. It's less of "the unsafe book" and more "the advanced book", covering lower-level details and advanced concepts that aren't touch on by the book. One gripe I have is that it kind of pushes the idea that unsafe is bad and evil, which is not true at all: > The Dark Arts of Unsafe Rust > THE KNOWLEDGE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS… — ibraheemdev, 2021-05
Related videos
- Gtk to Qt - a strange journey [linux.conf.au 2014] · Konstantin Bläsi · 46:05
- LISA11 - Fork Yeah! The Rise and Development of illumos · USENIX · 1:04:03
- Why Your Vote Doesn't Count · CGP Grey · 6:31
- Once you understand game theory, you understand the world. · Veritasium · 27:18
- CppCon 2015: Andrei Alexandrescu “std::allocator...” · CppCon · 1:12:27
- Lexical Scanning in Go - Rob Pike · GoogleFOSSSydney · 51:17
- Behind the Scenes of iOS Security · Black Hat · 51:31
- Why Electronic Voting Is Still A Bad Idea · Tom Scott · 12:00
- USENIX Security '18-Q: Why Do Keynote Speakers Keep Suggesting That Improving Security Is Possible? · USENIX · 51:22
- Defcon 18 Changing threats to privacy Moxie Marlinspike Part · killab66661 · 42:50
- CppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step” · CppCon · 59:33
- RustConf 2018 - Closing Keynote - Using Rust For Game Development by Catherine West · Rust Programming Language · 42:29
- CppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17” · CppCon · 1:19:52
- Ideas about a new programming language for games. · Jonathan Blow · 1:55:24
- CppCon 2014: Mike Acton "Data-Oriented Design and C++" · CppCon · 1:27:46
- 28c3: The Science of Insecurity · 28c3 · 59:23