4 ms·
There's a bootstrapping process that has to happen to compile the compiler. Moving up the language standard chain requires that compilers compiling the compile
by cogman10 1y ago
There's a bootstrapping process that has to happen to compile the compiler. Moving up the language standard chain requires that compilers compiling the compiler need to also migrate up the chain.
So you can never be perfectly bleeding edge as it'd keep you from being able to build your compiler with an older compiler that doesn't support those bleeding edge features.
Imagine, for example, that you are debian and you want to prep for the next stable version. It's reasonable that for the next release you'd bootstrap with the prior releases toolset. That allows you to have a stable starting point.
- rmu09 1y agoAren't they talking about the c++ dialect the compiler expects without any further -std=... arguments? How does that affect the bootstrapping process? This https://gcc.gnu.org/codingconventions.html https://gcc.gnu.org/codingconventions.html should define what C/C++ standard is acceptable in the GCC.
- cogman10 1y agoThe way I read withzombies's comment (and it could be wrong) was they were talking about the language version of the compilers source. I assumed that from the "dogfooding" portion of the comment.
- maxlybbert 1y agoCorrect, this is a discussion of which language version the compiler should follow if the programmer doesn’t specify one. It’s not about which features are acceptable when implementing the compiler.
- stabbles 1y agoThis is not the case. They are discussing the default value of `g++ -std=...`. That does not complicate bootstrapping as long as the C++ sources of GCC are compatible with older and newer versions of the C++ standard.
- cogman10 1y ago> as long as the C++ sources of GCC are compatible with older and newer versions of the C++ standard. I've worked on a number of pretty large projects. If the target for the source code changes it can be really hard to keep C++20 features from creeping in. It means that you either need to explicitly build targeting 11, or whoever does code reviews needs to have encyclopedic knowledge of whether or not a change leaked in a future feature. It is "doable" but why would you do it when you can simply keep the compiler targeting 11 and let it do the code review for you.
- quietbritishjim 1y ago> ... why would you do it when you can simply keep the compiler targeting 11 ... It doesn't appear to me that the parent comment was implying otherwise. The default is changing for any compilation that doesn't explicitly specify a standard version. I would have thought that the build process for a compiler is likely careful enough that it does explicitly specify a version.
- cogman10 1y ago> It's the type of dog fooding they should be doing! It's one reason why people care so much about self-hosted compilers, it's a demonstration of maturity of the language/compiler. I could be misreading this, but unless they have a different understanding of what it means to dog fooding than I do then it seems like the proposal is to use C++20 features in the compiler bootstraping.
- ziotom78 1y agoI believe they are really referring to the default mode used by GCC when no standard is explicitly stated. The email mentions that the last time they changed it was 5 years ago in GCC 11, and the link <https://gcc.gnu.org/projects/cxx-status.html#cxx17 https://gcc.gnu.org/projects/cxx-status.html#cxx17> indeed says > C++17 mode is the default since GCC 11; it can be explicitly selected with the -std=c++17 command-line flag, or -std=gnu++17 to enable GNU extensions as well. which does not imply a change in an obscure feature (bootstrapping) that would only affect a few users.
- kstrauser 1y agoCounterpoint: you could write a C++ compiler in a non-C/C++ language such that the compiler’s implementation language doesn’t even have the notion of C++20. A compiler is perfectly capable of compiling programs which use features that its own source does not.
- cxr 1y agoThat's not a counterpoint—at least not to anything in the comment that you're (nominally) "responding" to. So why has it been posted it as a reply, and why label it a counterpoint?
- kstrauser 1y agoRead them again a couple more times and it may become clear. The prior post seemed to be claiming that this required any form of a bootstrapping process, when it does not.
- cxr 1y agoYou have lost the plot, and you are wrong.
- wat10000 1y agoThis particular compiler does require bootstrapping, and that's obviously what "the compiler" is referring to in that comment. Building your compiler in another language doesn't help at all. In fact, it just makes it worse. Dogfooding C++20 in your compiler that isn't even built in C++ is obviously impossible.
- kstrauser 1y agoIt absolutely does not. There is no part of C++20 that requires the implementing compiler to be written in C++20. My original point is that you can write a compiler for any language in any language.
- 1y ago