Announcement

Collapse
No announcement yet.

GCC 11 Now Defaults To C++17 Dialect By Default

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

  • GCC 11 Now Defaults To C++17 Dialect By Default

    Phoronix: GCC 11 Now Defaults To C++17 Dialect By Default

    Following the proposal at the end of last year over GCC 11 aiming to default to C++17 for its C++ front-end, that change is now in place for GNU Compiler Collection 11...

    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
    How much does enabling newer standards slow down compiling of older code? Has anybody tested that?

    Comment


    • #3
      Yes, Michael usually does that too.
      But as new standards get usually a little safer, you might spend more time compiling but less time debugging things the older ones allowed

      Comment


      • #4
        Originally posted by JacekJagosz View Post
        How much does enabling newer standards slow down compiling of older code? Has anybody tested that?
        why should it slow down compiling and why you aren't interested at all how it affects something more important, like code generation ? old code will use newer standard library, which will use newer language features which usually speed up compiling

        Comment


        • #5
          Originally posted by JacekJagosz View Post
          How much does enabling newer standards slow down compiling of older code? Has anybody tested that?
          Why on earth would it take longer? It is not extra optimization passes, just some more stuff allowed. Stuff already parsed with lower standard limits so that the compiler can output helpful error messages.

          Comment


          • #6
            Being a bit nit-picking her

            c++17 is a base standard.
            gnu17 would be a dialect.

            Comment


            • #7
              Originally posted by carewolf View Post

              Why on earth would it take longer? It is not extra optimization passes, just some more stuff allowed. Stuff already parsed with lower standard limits so that the compiler can output helpful error messages.
              With higher standards, more and more stuff becomes constexpr, making compilation slower.

              Not the only reason but that's one of them.

              Comment


              • #8
                Originally posted by Mangix View Post

                With higher standards, more and more stuff becomes constexpr, making compilation slower.

                Not the only reason but that's one of them.
                That doesn't make anything slower. Constexpr is only a helper for the programmer to ensure they program in a way that can be const propagated, a compiler does const propagation in any case.

                The only difference C++17 makes is allow you to use those expressions in new places, but if you have code that compiled with C++14 you are not doing that. So you are just getting the const propagation that has always taken place.
                Last edited by carewolf; 29 June 2020, 02:06 AM.

                Comment


                • #9
                  I was under the impression that constexpr enables compile time evaluation.

                  Comment


                  • #10
                    Originally posted by carewolf View Post

                    That doesn't make anything slower. Constexpr is only a helper for the programmer to ensure they program in a way that can be const propagated, a compiler does const propagation in any case.

                    The only difference C++17 makes is allow you to use those expressions in new places, but if you have code that compiled with C++14 you are not doing that. So you are just getting the const propagation that has always taken place.
                    I'm sorry to say but you're mistaken here - constexpr is a keyword that allows compile-time evaluation: https://en.cppreference.com/w/cpp/language/constexpr. It can indeed slow down compilation time, but it results in runtime speedups and compile-time checking of results, so the tradeoff is generally considered worth it.
                    Last edited by archibald; 29 June 2020, 03:25 AM.

                    Comment

                    Working...
                    X