Get the latest tech news
No-Panic Rust: A Nice Technique for Systems Programming
Can Rust replace C? This is a question that has been on my mind for many years,as I created and now am tech lead forupb, a C libraryfor Protocol Buffers. Th...
For numeric operations like addition, Rust introduces overflow checks (which panic on failure) in debug mode, but leaves them out of opt builds. For the case of upb, this seems like a great option, because it gives us extra consistency checks in debug mode without suffering the problems of panic in release builds. It’s clear that writing no-panic code is not a core use case that the language focuses on, but there are many situations (embedded, Linux Kernel, etc) where we want to avoid panics.
Or read this on Hacker News