News for hackers. Stuff that matters.
Re:Taming Go’s memory usage, or how we avoided rewriting our... by jcelerier on Tuesday September 21, 2021 @03:31PM (#28608895)
It kills me that RAII is considered modern c++. It's there since 1983 aha, what do you think fstream and std::vector are if not RAII wrappers over files or memory
Re:Taming Go’s memory usage, or how we avoided rewriting our... by oconnor663 on Tuesday September 21, 2021 @04:02PM (#28609252)
I think before the introduction of move semantics in C++11, there were a lot of cases where you needed new and delete to get basic things working. (Moving an fstream around is a relevant example.) So the modern rule of "don't use new and delete in application code" really wasn't practical before that.
Re:Taming Go’s memory usage, or how we avoided rewriting our... by jcelerier on Tuesday September 21, 2021 @06:32PM (#28610847)
No, pretty much everything could be done with swap (like moving an fstream as you say). Sure, it's a bit more cumbersome, but it was still RAII.
Re:Taming Go’s memory usage, or how we avoided rewriting our... by nyanpasu64 on Tuesday September 21, 2021 @07:20PM (#28611240)
I suppose RAII is an old concept, but move semantics allowing RAII to transfer ownership and avoid manual new/free of non-copied resources was uncommon until C++11.
Re:Taming Go’s memory usage, or how we avoided rewriting our... by bluGill on Tuesday September 21, 2021 @04:49PM (#28609747)
before unique_ptr we didn't have a good way to handle raii for a lot of things. I wrote a lot of RAII wrappers for various things (still do, but a lot less). Attempts like auto_ptr show just how hard it is to make raii work well before C++11.

Yes we had RAII, but it didn't work for a lot of cases where we needed it.