Re:Near-duplicate features of C++ (2017)
by otabdeveloper2 on Friday May 24, 2019 @12:53AM
(#19998595)
> maybe, just maybe, we won't see "new"s or "delete"s in most future codebases?
I haven't seen 'new' or 'delete' in the wild for a decade now. (Well, except for various legacy libraries or student code on Github.)
Me too. I've been writing pretty much only C++ for 20 years, and if I'd go back and count, I think I'd have maybe a dozen times where I used new/delete, none of those in the last 10 years. Like all languages that are actually used, there is much one can complain about in C++, but claiming that one needs a lot of manual memory management is done mostly by people who haven't written much if any C++.
Or people who care about heap fragmentation and cache misses.
Sure, but those people don't want GC either. Not to say that all languages that are not C++ are garbage collected, but the people who complain about manual memory mgmt are not the ones who care about those things.
Qt code uses 'new' extensively because Qt components take ownership of components and manage memory allocation automatically.
Author has a point there, but maybe, just maybe, we won't see "new"s or "delete"s in most future codebases? (we have smart pointers now) Or non-intuitive macros (yay constexprs!)
I see these as stepping stones from C to where we are today without breaking everything at once or doing it with a whole other programming language.