by stefanchrobot · 5y ago · 0 comments
If you have arguments with the implementation that's one thing, but what would you prefer? That the language just stay still, warts and all? Ok... well then just keep using C++03. But you probably don't want to do that, because '03 sucks, right? Ok, and what would make it better? ----> All the things they're trying to fix via C'11 through C'20...
And as I pointed out in another comment, these additions are mostly not aimed at C++ application developers. If you don't need them (and you probably won't) then don't use them.
That's often been true in other recent C++ standards, but looking at the linked page about C++20 in particular, quite a lot of those points might reasonably appear in application code.
If you don't need them (and you probably won't) then don't use them.
The trouble with this argument has always been that if your language provides a certain feature or syntax, even if you don't use it, there is no guarantee that everyone else whose code you depend on won't use it either.
Some language features are inherently contagious. If you are calling code that uses exceptions or const qualifiers or asynchronicity, you probably need to take that into account in your own code. I recognise that these aren't particularly esoteric as language features go, but I've still seen plenty of teams over the years that attempted to avoid using them in C++ based on some argument about making things too complicated, mostly with results that weren't great.
Even for new language features that are expected to be used mostly within libraries and not to be seen much in application code, you might still have to dig into the source code for a library to trace a bug or performance problem, which means in practice you still need enough awareness of the full language to do that.
Extra complexity in the design of a programming language always comes at a cost, whether or not you intend to use it. The important question is usually whether the price is worth paying.
Of course - the Google Style Guide being a prime example.
> you might still have to dig into the source code for a library to trace a bug or performance problem
I've been programming in C++ since the 1980s and I've never even tried to debug someone else's library - life's too short, and it's not what I'm getting paid for. Have you looked at the source for (say) your Standard Library implementation? If you are not intimately familiar with it (which kind of negates the advantages of using a library in the first place) you won't stand a chance of debugging it, no matter how deep your knowledge of the C++ Standard.
All the time, why would this be unusual? I actually find myself often looking over MSVC's implementation straight in VS and comparing it to libstdc++:
https://github.com/gcc-mirror/gcc/tree/master/libstdc%2B%2B-...
One recent thing I caught from going over the implementation was how MSVC's implementation of std::tuple is semantically different from GCC's, where GCC constructs left to right, but MSVC constructs from right to left.
I also debug through boost and have reported bugs, or just found bugs in it that had already been reported.
Qt is another library that I am constantly reading over, heck if anything just for the sake of learning interesting UI implementation techniques.
Anecdotally, I find it unfortunate that people who talk about how they've been programming in C++ for 30+ years are almost always the ones who have very backwards and archaic practices and talk about those practices like they are common place.
"I've been programming in C++ for 500 years and never once have I had to do this, therefore it follows that no other C++ developer will ever have to do it either!"
There are entire generations of developers who've learned C++ and use it in ways very different from you, in technical domains you may not even realize exist. Don't presume that just because you personally have never done something, that it can't possibly be relevant or useful to an entire community of developers using the same technologies as you but in different ways.
What is your general strategy to deal with bugs in other code? Sometimes just stepping through other code and fixing something small there is by far the fastest way to get things done. Not life-shortening at all :) I.e. way faster than alternatives like submitting a bug report and hoping it gets fixed, or hacking around the bug, or looking for another library. I do not understand why you'd abandon the idea out of principle. Perhaps you had some really bad experiences with it when you just started or so?
Have you looked at the source for (say) your Standard Library implementation?
Very often. Usually not to 'debug it' in the sense of finding bugs but to figure out in detail why my code invokes UB or asserts or whatever somewhere else. Or in case of documentation not being clear to find out what really happens. Also a good way to learn by seeing how others write code.
Indeed, though it's been going on since long before Google was around!
Have you looked at the source for (say) your Standard Library implementation? If you are not intimately familiar with it (which kind of negates the advantages of using a library in the first place) you won't stand a chance of debugging it, no matter how deep your knowledge of the C++ Standard.
Some years ago, I did exactly that. Found a bug in it, too.
Part of my concern with the ever-increasing complexity of C++ since C++11 is that what I did back then would be increasingly difficult today, because there are so many intricacies aimed at library writers squeezing out every last drop of performance. Of course, for a systems programming language like C++, that emphasis is understandable. But as I said, extra complexity in language design always comes at a cost. And if we'd had to wait for someone upstream to fix the bug in the library I mentioned above, that cost would have had quite a lot of digits in it and a dollar sign at the front.
For example, the style guide says that C++ exceptions are the way to go...except that by the time the guide was written there was already too much existing code that wasn't exception safe. Therefore the guide says that regretfully, exceptions cannot be used.
Edit: clarification
No one ever forces you to use extra features. But if you can improve/reduce your code, why not?