| ▲ | cogman10 4 hours 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. |
|
| ▲ | stabbles 3 hours ago | parent | next [-] |
| This 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 3 hours ago | parent [-] | | > 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. | | |
| ▲ | bluGill an hour ago | parent | next [-] | | Compilers often allow things in 11 that technically are not there until some later standard. Or sometimes things they have always allowed finally got standardized in a later version. Setting your standard to 11 if that is what you want to target it a good first step but don't depend on it - the real tests is all the compilers you care to support compile your code. Even if you only target 11, there may be advantages to setting a newer version anyway. Sometimes the standard finally allows some optimization that would work, or disallows something that was always error prone anyway. I would recommend you set your standard to the latest the compiler supports and fix any bugs. Solve your we have to support older standards problem by having your CI system build with an older compiler (and also the newest one). C++ is very good at compatibility so this will rarely be a problem. | |
| ▲ | quietbritishjim 3 hours ago | parent | prev [-] | | > ... 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 3 hours ago | parent [-] | | > 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 2 hours ago | parent [-] | | I 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> 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. |
|
|
|
|
|
| ▲ | rmu09 3 hours ago | parent | prev | next [-] |
| Aren'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 should define what C/C++ standard is acceptable in the GCC. |
| |
| ▲ | maxlybbert 2 hours ago | parent | next [-] | | Correct, 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. | |
| ▲ | cogman10 3 hours ago | parent | prev [-] | | The 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. |
|
|
| ▲ | kstrauser 3 hours ago | parent | prev [-] |
| Counterpoint: 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 3 hours ago | parent [-] | | That'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 an hour ago | parent [-] | | Read 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 an hour ago | parent | next [-] | | You have lost the plot, and you are wrong. | |
| ▲ | wat10000 an hour ago | parent | prev [-] | | This 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 an hour ago | parent [-] | | It 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. | | |
| ▲ | wat10000 30 minutes ago | parent [-] | | What is "It absolutely does not" responding to? I didn't say anything about a C++20 compiler needing to be written in C++20. |
|
|
|
|
|