News for hackers. Stuff that matters.
Re:Explore the ownership system in Rust by MichaelMoser123 on Tuesday January 20, 2015 @02:40PM (#8918980)
Similar to C++11 - here they added some smart pointers

  std::shared_ptr - 'owner' smart point with reference counter 

  std::weak_ptr - borrowing thing (non owning smart pointer)

  std::unique_ptr - exlusive ownership (transferable)
well reference counting has its problems: like circular reference chains that will cause leaks, now one is supposed to break these cycles with borrowing smart pointers (it still sucks); also in shared_ptr's the reference count is an atomic operations, even if you only use it from one thread; no way to change that (i think that's an oversight)

However what really sucks in C++ are the default constructor/copy constructor, etc operation; This was done so that C structures behave like classes - most of the C++ goodness is due to these backward compatibility with C requirements.

There are no comments on this comment yet.