Announcement

Collapse
No announcement yet.

GCC 11 Will Let You Use -std=c++23 But Without Turning On Any New Features

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

  • GCC 11 Will Let You Use -std=c++23 But Without Turning On Any New Features

    Phoronix: GCC 11 Will Let You Use -std=c++23 But Without Turning On Any New Features

    A late change to GCC 11 is recognizing the -std=c++23 compiler option but without actually enabling any new features of this next major version of the C++ programming language...

    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
    This is mainly for helping projects that will eventually default to using that flag but will still build cleanly with C++20 level functionality in the upcoming GCC 11 compiler release.
    It seems pointless: when people will actually start using C++23 features (say, in 2025 or later) gcc 11 will fail to compile them, no matter which flag is used.

    Comment


    • #3
      Originally posted by klapaucius View Post
      It seems pointless: when people will actually start using C++23 features (say, in 2025 or later) gcc 11 will fail to compile them, no matter which flag is used.
      The reason mentioned in the article is rubbish. The flag is enabled so that GCC can be developed for C++23 features and those features be tested.

      Comment


      • #4
        I wish they'd go the LLVM route and add a letter so it's named something like c++23a to denote it's still in alpha or c++d as a generic name for latest in development.
        Last edited by skeevy420; 27 January 2021, 12:28 PM.

        Comment


        • #5
          Originally posted by klapaucius View Post
          It seems pointless
          It is not entirely pointless. Having the flag (which currently does nothing) allows the tooling that uses GCC to start to get ready and test their functionality too. Cmake, qmake, and others can create the eventual GCC invocation based on the c++ standard level and they need to be able to start their updates. Given the often long development and deployment cycles of the entire ecosystems that need to understand the next number, enabling the capabilities in GCC earlier is better (even if it currently does nothing other than tolerate the flag).

          Comment


          • #6
            Originally posted by klapaucius View Post
            It seems pointless: when people will actually start using C++23 features (say, in 2025 or later) gcc 11 will fail to compile them, no matter which flag is used.
            it's very stupid comment. flag is used by makefile, gcc will be different, but makefile will stay. and in source code you could check every feature separately with feature test macros, i.e. code could also compile on gcc11, on gcc12, on gcc13 and on gcc14. and i plan to start using (some of)c++23 features in 2022
            Last edited by pal666; 27 January 2021, 05:34 PM.

            Comment


            • #7
              Originally posted by skeevy420 View Post
              I wish they'd go the LLVM route and add a letter so it's named something like c++23a to denote it's still in alpha or c++d as a generic name for latest in development.
              you could use c++2b if it'll make you happier

              Comment


              • #8
                Originally posted by pal666 View Post
                it's very stupid comment. flag is used by makefile, gcc will be different, but makefile will stay. and in source code you could check every feature separately with feature test macros, i.e. code could also compile on gcc11, on gcc12, on gcc13 and on gcc14. and i plan to start using (some of)c++23 features in 2022
                So the advantage is...? That you can use the same flag -std=c++23 across all your base code, starting from now, but still have to manually pick the new features as they become available when you adopt newer compilers, by scattering #ifdefs all around your code?

                And what if C++23, as it often happens, deprecates or removes some features from earlier standards? You will have to use an older compiler anyway, for specific parts, or refactor your code. But hey, at least you can keep your -std=c++23....

                Comment


                • #9
                  Adding -std=c++23 enables the addition of C++23 features. Support for P1679 (std::string::contains) has been added and P0330 is in the works.

                  Comment

                  Working...
                  X