r/programming • u/MikeBonzai • Jul 13 '19
Herb Sutter: Why does the C++ standard ship every three years?
https://herbsutter.com/2019/07/13/draft-faq-why-does-the-c-standard-ship-every-three-years/32
Jul 13 '19 edited Jul 14 '19
I wish there were more frequent drops for libstdc++, because there's really no reason it must be explicitly coupled with the release of the language.
One is an API, the other is a grammar. There should be nothing wrong with releasing multiple versions of an API based off the same grammar that's already released.
---
Edit: Seeing a lot of responses saying you can't completely de-couple grammars from all the APIs using them, and I do agree. My point was that if some APIs only require earlier versions of the grammar than those which they are first being released with, then maybe they should be part of a smaller C++ <grammar_version>.<libstdc++_version> incremental update that is only dependent on the minimum version of the grammar they require.
e.g.
std::filesystem
std::net
std::optional
These mostly require nothing more than c++11 -- yet they show up as late as c++17, and c++20 !
25
u/badsectoracula Jul 14 '19
In theory yes, but i think parts of that API rely on compiler magic.
Personally i'm not a fan of C++ anyway (though i still have to use it), but one thing i believe should happen (and not just to C++ but any language where it applies) is to split the standard library (both the C and the C++ ones) in two parts, one that needs compiler magic and another that builds on the first part and then have the second (the part that doesn't need compiler magic) part available as an open source library that all compilers can use.
6
u/matthieum Jul 14 '19
FWIW, this is what Rust does.
coreis where the magic happens,stdis the OS abstraction/utility provider layer, and I agree this is a nice distinction. It's also pretty useful for embedded programming since there's no OS to build on, so nostd, yetcoreis still necessary.2
0
u/ImprovedPersonality Jul 14 '19
Not an expert, but I can’t think of any reason why the stdlib would depend on compiler magic. When properly written, shouldn’t it be just like any other library and compile with any compiler which supports the required C++ standard?
5
u/Opening_Addendum Jul 14 '19
C++ has <type_traits> which is just compiler bultins/language level features masquerading as a library. You can't implement it without help from the compiler. C has <complex.h> which can't be implemented without compiler magic.
3
u/Plorkyeran Jul 14 '19
What do libstdc++ versions have to do with c++ language versions? It's released with new gcc versions because it's part of gcc, and gcc's release cycle is entirely disconnected from the c++ release cycle.
2
u/shevy-ruby Jul 14 '19
It's quite simple - you will run into compile-related problems if you don't have a proper libstdc++. To claim how both is decoupled from one another is trying to argue without it being based on factual realities.
A good example is LFS/BLFS:
http://www.linuxfromscratch.org/lfs/view/development/chapter05/gcc-libstdc++.html
IMO this step should not HAVE to be necessary. It's also annoying when ABIs change leading to strange compile-errors related to C++. You don't run into this problem with C. So from this point of view, I totally and completely agree with yuri_sevatz here - it would be much better if we could resolve this annoying situation related to libstdc++.
If it were to have nothing to do with c++ or gcc, then why would the LFS/BLFS book have a specific chapter to compile libstdc++ very early on during the LFS-bootstrap process? So that disproves your claim how it must be entirely disconnected from c++, purely from a practical point of view alone. There aren't that many alternatives to gcc either - there is clang/llvm and the obscure crap used on windows, but that was it mostly for when you want to compile c++ code in the wild.
Unfortunately we all know that the C++ committee worships cthulhu so they will only make things more complex rather than simpler.
1
2
Jul 14 '19
There are reasons. For instance parts require rvalue references, constexpr, which you can't do without language support. Plus there's magic like std::function.
9
u/Quincunx271 Jul 14 '19
Plus there's magic like std::function.
std::functionis entirely implementable in user code.
5
u/bbrabbitt Jul 14 '19
This is a good thing as C++ needs to catch up with the development of programming technology. For example, the modules and coroutines that C++20 adds to the language could improve the quality of the code as well as the efficiency(I can't remember how much time I cost on compiling when writing a medium size Qt project). If C++ doesn't continue upgrading itself, it will be replaced by other more friendly languages like golang and rust.
The C++ standard committee has made efforts on improving the end-user experience in a wrting C++ program. Although many people criticize C++'s bad design, for me I can't blame their effort.
5
u/circlesock Jul 14 '19
The problem is knowing which bits to ignore (i.e. goddamn most of it) and which bits to use, and getting everyone on your team ignoring and using the same bits. So much of C++ is just crap, they never throw anything away, because backward compat. This is actually a very successful strategy (see: x86 architecture, Microsoft Windows), but makes it just godawful to deal with. So many other things will never be "popular" or "mainstream" like C++. But they can still be better.
-14
u/shevy-ruby Jul 14 '19
They do it so that they can sell C++ support - because you are going to need it as the standards committee keeps on worshipping cthulhu, and making C++ more and more complex - and bigger - with every release.
-27
u/Workaphobia Jul 13 '19
In other words, the standards committee discovers continuous delivery.
0
Jul 14 '19
[deleted]
9
u/MindSpark289 Jul 14 '19
That's why you write to the finalized C++11 standard, or C++14, or C++17. All it takes is passing -std=C++11 in the command line.
The updates don't delete the old standard
0
Jul 14 '19
[deleted]
11
u/Alphaetus_Prime Jul 14 '19
The whole thesis of this article is that it's better to have a regular release schedule and delay stuff that isn't ready to the next release than it is to delay the release itself
-22
-53
u/tonefart Jul 13 '19
If you need to keep releasing new versions for C++, it means you fucked up every revision/modifications for the language that you need to correct with newer version number.
23
9
57
u/jl2352 Jul 14 '19
I feel like the main reason is because of C++0x. It took 8 years, and the delay was pretty painful. Similarly Java 7.
It is a trend now for languages to move to a regular release schedule. It's much nicer for the end users. It's not just language updates. Everything has moved this way. Like remember when browser releases were every few years? Terrible times.