News for hackers. Stuff that matters.
Re:Implementing Go's defer keyword in C++ by foo101 on Saturday October 21, 2017 @11:30PM (#15525031)
My intention is not to nitpick but I am genuinely trying to understand this from a pedantic perspective.

> C++ has a neat feature called Resource acquisition is initialization, a.k.a RAII.

Is this really a feature of C++, or is this a design pattern/best practice that developers have discovered and use to write safer C++ code?

Re:Implementing Go's defer keyword in C++ by pjmlp on Sunday October 22, 2017 @05:28AM (#15525886)
It is a bit of both, as replied on siblling comments.

While RAII was coined by the C++ community, it is not unique to C++, there are other languages that support it.

Re:Implementing Go's defer keyword in C++ by ovao on Sunday October 22, 2017 @01:07AM (#15525250)
It's not a discovery per se, since its creation was deliberate, but it's a practice exercised throughout the STL (the C++ standard template library), and is a term coined by C++ creator Bjarne Stroustrup himself. It could be considered a "standard pattern" in lieu of a better term.
Re:Implementing Go's defer keyword in C++ by Merad on Saturday October 21, 2017 @11:56PM (#15525091)
A bit of both, IMO. RAII is a design pattern, not a language feature. However, it’s a pattern made possible by the semantics of destructors and object lifetimes in C++. The creator of C++ (Stroustrup) developed RAII within the first few years of the language’s existence.