News for hackers. Stuff that matters.
Re:C++'s Rule of Zero by fsloth on Sunday June 28, 2015 @05:57AM (#9792999)
I usually use three patterns for memory management and they seem to work:

- copy by value for small datums

- store large datums in shared-ptrs if pointer access speed will not cause a bottleneck

- Relational model: I use large database objects for storing inter referencing objects - i.e. I don't use any pointer type for storing refences in large interlinked structures but handles such as indices or map keys.

I agree, trying to implement borrow checking or garbage collection 'quickly' through the type system in C++ usually leads to a world of pain.

Better designed languages offer poor intuition to C++ in this sense because the examples in those languages leverage the well designed type system. If one wants to do advanced stuff in C++ the correct way is to model that in the program code and not through clever constructor tweaks.

Re:C++'s Rule of Zero by kabdib on Sunday June 28, 2015 @06:24AM (#9793031)
Vanilla "struct" data in members, plus reference pointers to data held caches of a database/memcached system are a pretty powerful way to work. You tend to not do assignment because making extra copies of stuff that's persistent has bad semantics; it will hurt a lot if you (say) have six copies of a Person and two or three pieces of code decide to do uncoordinated updates.