3 ms·
> RAII and scope are both core ideas in c++ and always have been. I would say that's debatable. RAII definitely dates back to the earliest days of C++, but yo
by Merad 3y ago
> RAII and scope are both core ideas in c++ and always have been.
I would say that's debatable. RAII definitely dates back to the earliest days of C++, but you don't have to know it in order to use the language. Even today there are many professional C++ devs who've never really learned RAII because they write C with classes style code. I first started learning C++ about 20 years ago and IIRC at the time usage of RAII was still in the minority but there was real momentum towards it being considered the "right" way to do C++.
- zabzonk 3y agowell, i started using c++ in the late-80s, and even back then RAII (possibly not under that (bad, IMHO) name) was widely seen as an important feature of the language. how else could you implement a string class (which you had to do yourself back then)?
- Merad 3y ago> how else could you implement a string class I'm not claiming that it's good C++ code (or good code by any measure) but I imagine those "C with classes" devs would do something like: my_string* s = new my_string(); s->initialize("hello world"); // ... s->destroy(); delete s;
- zabzonk 3y agowell, i have seen a lot of very bad c++ code in my time, but nothing like this.