Announcement

Collapse
No announcement yet.

GCC 10 Adds Late Support For -std=c++20 To Target C++20

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • GCC 10 Adds Late Support For -std=c++20 To Target C++20

    Phoronix: GCC 10 Adds Late Support For -std=c++20 To Target C++20

    With C++20 now effectively complete, GCC developers have made a rather late change for GCC 10 that is also long overdue and that is introducing the -std=c++20 switch for targeting C++20...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    I thought the difference between --std=c++1z and --std=c++17 was that the later meant the standard as specified, so full, and so with --std=c++2a and --std=c++20, it seems a bit early to accept the switch for the full standard with a few full features still missing (modules). Hopefully they won't bump the __cplusplus define, so that can be used instead having to look up the special define and number for every single feature you want to use.
    Last edited by carewolf; 16 February 2020, 07:04 AM.

    Comment


    • #3
      Standard versions with the letters at the end are draft specs, so they generally hold feature implementations, that are not accepted yet. Switches with proper years are the final spec implementations, even if not full.

      Comment


      • #4
        Originally posted by carewolf View Post
        I thought the difference between --std=c++1z and --std=c++17 was that the later meant the standard as specified, so full
        you were wrong. parts of c++17 library were implemented only two releases after gcc got -std=c++17 switch(note one dash instead of two). 1z means third in 2010..2019(they started counting from x, probably because first one morphed from 0x). placeholder instead of concrete year was used because concrete year wasn't known yet. because before c++17 was published, 17 was planned publication year, but by no means guaranteed. now they are counting from a, i.e. 2a will be 20, 2b will probably be 23 and 2c will probably be 26.
        btw, there's c2a in the making
        Last edited by pal666; 16 February 2020, 12:23 PM.

        Comment


        • #5
          Originally posted by pal666 View Post
          you were wrong. parts of c++17 library were implemented only two releases after gcc got -std=c++17 switch(note one dash instead of two). 1z means third in 2010..2019(they started counting from x, probably because first one morphed from 0x). placeholder instead of concrete year was used because concrete year wasn't known yet. because before c++17 was published, 17 was planned publication year, but by no means guaranteed. now they are counting from a, i.e. 2a will be 20, 2b will probably be 23 and 2c will probably be 26.
          btw, there's c2a in the making
          There were no major features in C++17, it was all minor details. Or at least was after they removed concepts from the list of possible proposals to include, and which at one point was activated by -std=c++1z.

          Comment


          • #6
            Originally posted by carewolf View Post
            I thought the difference between --std=c++1z and --std=c++17 was that the later meant the standard as specified
            The reason for adding -std=c++20 to gcc now (now that the value of "a" (for c++2a) is known) is that the various infrastructure (IDEs, code generators, build processes) can start to be updated in advance of full implementation, as they, too, need updates to allow one to specific c++20 (and to pass that along to the compiler), not that it means c++20 (or c++17 before it) is 100% implemented by the compiler today. And, realistically, some features of c++20 have been of interest, and are valuable, today, even if not all of the compilers implement all of the features (and some of the feature implementations depend on libraries, and not the compiler itself).

            Comment


            • #7
              Originally posted by CommunityMember View Post

              The reason for adding -std=c++20 to gcc now (now that the value of "a" (for c++2a) is known) is that the various infrastructure (IDEs, code generators, build processes) can start to be updated in advance of full implementation, as they, too, need updates to allow one to specific c++20 (and to pass that along to the compiler), not that it means c++20 (or c++17 before it) is 100% implemented by the compiler today. And, realistically, some features of c++20 have been of interest, and are valuable, today, even if not all of the compilers implement all of the features (and some of the feature implementations depend on libraries, and not the compiler itself).
              That makes sense. Though most projects I know don't shy away from using the temporary names and requesting that from the compilers. In theory there is a risk in that when the final spec changes from the temporary implementation. It has always bugged me slightly, but so far I haven't seen any project burned by it.

              Comment


              • #8
                I was told that even though C++11 seems to require some library changes these are required by specs only with C++17.
                So those library changes should be done before C++17 can get the default.
                In other words - making C++20 a target means you can use those parts already available in GCC - and does not say that you can use everything which is part of C++20 standard specification. With this being obvious I am not aware of a reason for using a letter - as the standard is not implemented fully in both cases - except if the target year may be missed so a renaming would hurt if this is not indicated by just a letter. Without the letter the target specification is clear - but that target has to be reached in the future.
                So teaching modern C++ is not possible right now as you have to do things which would not be correct with changes started by C++11 and further refined by C++14 and C++17 - and C++17 seems to make requirements which should have been done with C++11.
                So I am waiting for C++17 being the default to than (hopefully) can use modern C++ fully without using old syntax/semantics still necessary (e.g. using C libraries).
                So if you want to rely on the full standard of C++20 you have to wait for C++20 to become the default.
                For C++17 as default some heavy lifting seems to still be necessary.

                Comment


                • #9
                  Originally posted by JMB9 View Post
                  So I am waiting for C++17 being the default
                  Last I heard defaulting to c++17 is targeted for the gcc 11 timeframe, and historically clang/llvm changes the defaults around the same time to maintain that particular default compatibility. So just hold your breath a bit longer....
                  Last edited by CommunityMember; 18 February 2020, 08:31 PM.

                  Comment


                  • #10
                    Originally posted by carewolf View Post
                    There were no major features in C++17, it was all minor details.
                    its additions were certainly smaller than c++20, but nevertheless they comprised 3 years of work and were far from minor
                    Last edited by pal666; 18 February 2020, 07:15 PM.

                    Comment

                    Working...
                    X