News for hackers. Stuff that matters.
Re:Garbage collected smart pointers in Rust via concurrent c... by loeg on Friday December 13, 2024 @05:04PM (#42412765)
> I'm not a rust guy (I've only done hello world), but my understanding is it only gives you unique pointers

Some very rough analogies:

  C++        : Rust
  unique_ptr : Box
  shared_ptr : Rc or Arc
  references : references
Re:Garbage collected smart pointers in Rust via concurrent c... by zozbot234 on Friday December 13, 2024 @06:03PM (#42413131)
A C++ reference is more like a Rust &UnsafeCell<T> in practice - and there are thorny issues around the possibility of null references in C++ (which are supposed to be insta-UB per the C++ standard but are allowed by most compilers) that introduce additional questions about what the best mapping might be.
Re:Garbage collected smart pointers in Rust via concurrent c... by umanwizard on Friday December 13, 2024 @10:32PM (#42414472)
One key difference between Rust smart pointers and C++ ones is that Rust ones can’t be null. So C++ unique_ptr is more like an Option<Box> that automatically calls unwrap_unchecked every time you try to use it.
Re:Garbage collected smart pointers in Rust via concurrent c... by loeg on Saturday December 14, 2024 @01:15AM (#42415040)
Fair enough.