|
|
Log in / Subscribe / Register

UB in Rust vs C

UB in Rust vs C

Posted Aug 15, 2024 6:40 UTC (Thu) by ralfj (subscriber, #172874)
In reply to: UB in Rust vs C by khim
Parent article: Standards for use of unsafe Rust in the kernel

> (e.g. it's UB in Rust to use uninitialized memory for fun and profit even if hardware have no objections).

Yeah, this is one of the major examples of something you can do in hardware but not in Rust (or C/C++). Such examples are always a justification for at least considering a language extension. Rust may one day expose an operation like LLVM `freeze` that makes it possible to write such code without UB. The mere existence of such an operation has its downsides, but I still expect it to happen. The discussion for that is at https://github.com/rust-lang/rfcs/pull/3605.


to post comments

UB in Rust vs C

Posted Aug 15, 2024 8:32 UTC (Thu) by taladar (subscriber, #68407) [Link] (1 responses)

Your link is broken by the period at the end of your sentence https://github.com/rust-lang/rfcs/pull/3605

UB in Rust vs C

Posted Aug 16, 2024 7:14 UTC (Fri) by ralfj (subscriber, #172874) [Link]

Ah, sorry for that, I got too used to systems that exclude trailing periods from auto-linking. It seems I can't edit my post here either. Thanks for posting the fixes link!


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds