4 ms·
This article is simultaneously both obsolete and completely current. Obsolete in that the C++ committee has addressed almost all of the issues raised (e.g. con
by gumby 7y ago
This article is simultaneously both obsolete and completely current.
Obsolete in that the C++ committee has addressed almost all of the issues raised (e.g. constructor semantics, xception semantics et al) though the discussion of site-of-error/handling-of-error continues unabated.
Later versions of C++ (17and 20) are powerful and expressive systems programming languages that aren’t like the object-oriented messes of old.
The reason that this article remains completely current is that I suspect the majority, and likely vast majority, of C++ is still written in C++03/C++11 and full of dreadful issues like the ones in the article.
- zwieback 7y agoTrue, I recently returned to C++ after many years absence and I'm thrilled with all the good stuff that has been added BUT it took me quite a while to learn how I'm going to unlearn/relearn my old practices.
- gumby 7y agoI decided to treat it as if it was a language I had never seen before. That helped a lot.
- mehh 7y agoLikewise, but also I now realise, after a long break I really like programming with "system languages". I get a certain amount of satisfaction that I don't get with higher-level languages, where I spend so much time plugging together half-built crappy modules. Partly this is because I have realised, I like knowing the nuts and bolts of what is going on in a computer and solving problems with consideration of how it will run. It also has less magic and crappy layers going on. C++ has evolved a lot from what I used many years ago, and it looks mostly for the better, thankfully we have escaped the 'thou must OO' age.
- zwieback 7y agoTotally agree. I enjoy the productivity in Python but when you look what's behind numpy, scipy, etc. there's a lot of C, C++ and even Fortran. It's good to know both.
- mehh 7y agoHad a brief look at boost-python (not actually done anything with it), and that looks quite straight forward for exposing C++ to Python.
- oefrha 7y agoI haven’t written anything nontrivial in C++ for many years and so far have only learned and used a couple minor features newer than C++11. Would you be kind enough to point to some resources on why C++17/20 are “powerful and expressive systems programming languages that aren’t like the object-oriented messes of old”?
- Animats 7y agoYes, please.
- gumby 7y agoLook for some parallel replies.
- gumby 7y agoI wrtote a reply to this question in a comment parallel to yours. In addition: I don't write many classes in the sense of the Gang of Four book. I do write classes that are really just ways to speak with the type system, e.g. a "class" that has one instance variable that is an integer, so takes up only as much space as a native int, yet perhaps acts a special kind of table index. Sequence manipulation, auto, and destructuring bind provide clearer ways to express algorithms without getting hung up in towers of class abstraction (an evil fetish) yet not lots of low-level manipulation and boilerplate like you'd see with C. In c++20 generics and templating are almost unified which makes expression so much clearer (most of the old templating syntax is unnecessary in most cases). It lets you manipulate the type system much more clearly. You can do a lot more at compiler time -- you'll never get the expressive power of the Lisp macro system, but it's a lot closer with a lot of the old syntactic junk discarded. Auto declaration has transformed the use of the type system and genericity. In terms of resources to learn this stuff: I haven't found any single good source of info for these revisions. I once wrote a comment on this but it took a while and of course vanished into the whirlwind of YC comments. So instead I'll suggest a web search for "new in c++17" and "new in c++20". I know that's kind of lame, but that's the best high level answer I can suggest. I will say www.cppreference.com is excellent, but when it comes to newer features you often need something a little higher level to really grok what it says. It might answer your specific question though. I follow the trip reports from committee meetings and read proposals that happen to interest me which often give context to a design decision. I started a new project (blank editor buffer) using C++-17 in 2016. I hadn't written c++ since around 2000 (though I'd previously been involved in g++ development since around '87.* So I treated it as if it were a brand new language I'd never seen before. The only book I bought was Stroustroup's "tour of C++" which introduced c++14, then used searches like the ones above to keep up with developments in C++. If you're in the same boat I'd say choose C++20, even though the full language isn't available yet, which is what I did with C++17. Some features I was able to bring in from Boost (which is where many new features begin) and some I just couldn't use until it was time to refactor something anyway. Still, this really made a difference. * yes before g++ was released by the FSF -- tiemann and I both worked at MCC at the time and used to have dinner at 3AM to discuss what each of us was working on, which is how we later came to start Cygnus.
- dxhdr 7y agoI'm not very familiar with the C++17 and 20 changes, how do they address the errors-during-constructor/destructor issues that the article mentions?
- gumby 7y agoNote: I also wrote a parallel reply with some other commentary. On the specific issue of constructors, a slight change to the semantics of error signalling in the constructors and the addition of the ":" syntax to constructors made a lot of difference.
- htfy96 7y agoFeel like the adoption of new versions of C++ is largely determined by sectors and behaves like a bimodal distribution. Most BigTech / Internet companies I stayed already transited to at least C++11 (and a significant amount has transited to C++17), but for others it's really dreadful because they are stuck in random binary blobs / legacy compiler toolchain / relying on UB or hacks, and if no unicorn appears the case just continues.