News for hackers. Stuff that matters.
Re:Writing into Uninitialized Buffers in Rust by codeflo on Wednesday May 21, 2025 @02:36AM (#44048862)
I don’t get the difference. In both C and Rust you can have pointers to uninitialized memory. In both languages, you can’t use them except in very specific circumstances (which are AFAIK identical).

There are two actual differences in this regard: C pointers are more ergonomic than Rust pointers. And Rust has an additional feature called references, which enable a lot more aggressive compiler optimizations, but which have the restriction that you can’t have a reference to uninitialized memory.

Re:Writing into Uninitialized Buffers in Rust by mk12 on Wednesday May 21, 2025 @01:14PM (#44053687)
I agree with you. My point is that the additional feature (references) creates a new potential for UB that doesn’t exist in C, and that justifies the “doesn't really ever occupy my mind as a problem” statement being criticized upthread. You can’t compare C to Rust-without-references because no one writes Rust that way. It’s not like C++-without-exceptions which is a legitimate subset that people use.