Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. I hear crickets chirping
Forum Updated to NodeBB v4.3 + New Features

I hear crickets chirping

Scheduled Pinned Locked Moved Unsolved C++ Gurus
25 Posts 6 Posters 873 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Kent-DorfmanK Offline
    Kent-DorfmanK Offline
    Kent-Dorfman
    wrote last edited by
    #3

    Did not, but never thought to create such an abomination. I do know that I prefer while(1) to for(;;;)

    1 Reply Last reply
    0
    • JonBJ Offline
      JonBJ Offline
      JonB
      wrote last edited by
      #4

      It's actually quite a bit worse than that. Read C++ has good reasons to specify that infinite loops are undefined behavior and shudder when you discover a compiler on

      #include <iostream>
      
      int main() {
        while (true)
          ; 
      }
      
      void unreachable() {
        std::cout << "Hello world!" << std::endl;
      }
      

      actually prints Hello world, apparently....

      1 Reply Last reply
      0
      • Kent-DorfmanK Offline
        Kent-DorfmanK Offline
        Kent-Dorfman
        wrote last edited by
        #5

        I also have no great aversion to using a labeled goto to create an infinite loop, which is often necessary as an event procesessor in embedded systems.

        1 Reply Last reply
        0
        • Kent-DorfmanK Offline
          Kent-DorfmanK Offline
          Kent-Dorfman
          wrote last edited by Kent-Dorfman
          #6

          I guess as long as it doesn't optimize out something like this:

          while(1) { asm("nop"); }
          

          Then I don't mind the "undefined behaviour of an empty loop.

          Also, a lot of embedded microcontroller examples use the empty while loop as a "stop processing on error" catch in both C and C++ examples...I guess incorrectly then?

          I don't know which clang version they are referencing but I tried the labeled goto variant

          label:
          goto label;
          

          empty loop and it works properly in both g++10 and clang+11

          1 Reply Last reply
          0
          • J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote last edited by
            #7

            No worries—C++26 is going to address this and make the behavior consistent across all compilers.

            Just 6 years away!


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            JonBJ 1 Reply Last reply
            1
            • J.HilkJ J.Hilk

              No worries—C++26 is going to address this and make the behavior consistent across all compilers.

              Just 6 years away!

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote last edited by
              #8

              @J.Hilk
              How come "C++26" is "6 years away"? Not 2026? Or does it get "adopted" next year but not "rolled out fully" for another 6 years/you are being ironic?

              J.HilkJ 1 Reply Last reply
              0
              • Kent-DorfmanK Offline
                Kent-DorfmanK Offline
                Kent-Dorfman
                wrote last edited by
                #9

                @Axel-Spoerl Now you're just makin me jealous. I'd love to do a couple weeks on a ketch rigged and outfitted for a toodle around the caribbean. Have fun!

                1 Reply Last reply
                0
                • Axel SpoerlA Offline
                  Axel SpoerlA Offline
                  Axel Spoerl
                  Moderators
                  wrote last edited by
                  #10

                  It'll be Montenegro / Albania this time. Albania will sure be fun, they have very little infrastructure for pleasure craft and shallow beaches in the North. So anchoring at 5m depth puts you a mile off shore.

                  Software Engineer
                  The Qt Company, Oslo

                  1 Reply Last reply
                  1
                  • JonBJ JonB

                    @J.Hilk
                    How come "C++26" is "6 years away"? Not 2026? Or does it get "adopted" next year but not "rolled out fully" for another 6 years/you are being ironic?

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote last edited by
                    #11

                    @JonB

                    @chatGPT explains the joke in I hear crickets chirping:

                    Excellent question! Let’s break it down clearly and simply.

                    When someone jokes:

                    “C++26 is only 6 more years away before release”

                    they’re poking fun at how long it often takes for compilers and tools to fully support new C++ standards after they are officially published.

                    Here’s the context in plain terms:

                    1. C++ naming: “C++26” is the standard planned to be finalized in 2026. So the name means the ISO committee is targeting 2026 to finish the standard.

                    2. But availability lags:

                      • Even though the standard is published in 2026, your compiler (like GCC, Clang, MSVC) won’t fully support all its features immediately.
                      • Historically it often takes 4–6 years after the standard date for widespread, stable, mainstream support.
                    3. Examples:

                      • C++17 was finalized in 2017, but many people didn’t have fully usable compiler support until ~2020–2021.
                      • C++20 was finalized in 2020, but full usable support (including modules, coroutines, concepts) is only maturing around 2024–2025.

                    So when someone says:

                    “C++26 is only 6 more years away before release”

                    they're joking:

                    ✅ The standard will be written in 2026.
                    ✅ But you probably won’t really use it comfortably in production until ~2032.


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    JonBJ 1 Reply Last reply
                    2
                    • J.HilkJ J.Hilk

                      @JonB

                      @chatGPT explains the joke in I hear crickets chirping:

                      Excellent question! Let’s break it down clearly and simply.

                      When someone jokes:

                      “C++26 is only 6 more years away before release”

                      they’re poking fun at how long it often takes for compilers and tools to fully support new C++ standards after they are officially published.

                      Here’s the context in plain terms:

                      1. C++ naming: “C++26” is the standard planned to be finalized in 2026. So the name means the ISO committee is targeting 2026 to finish the standard.

                      2. But availability lags:

                        • Even though the standard is published in 2026, your compiler (like GCC, Clang, MSVC) won’t fully support all its features immediately.
                        • Historically it often takes 4–6 years after the standard date for widespread, stable, mainstream support.
                      3. Examples:

                        • C++17 was finalized in 2017, but many people didn’t have fully usable compiler support until ~2020–2021.
                        • C++20 was finalized in 2020, but full usable support (including modules, coroutines, concepts) is only maturing around 2024–2025.

                      So when someone says:

                      “C++26 is only 6 more years away before release”

                      they're joking:

                      ✅ The standard will be written in 2026.
                      ✅ But you probably won’t really use it comfortably in production until ~2032.

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote last edited by
                      #12

                      @J.Hilk said in I hear crickets chirping:

                      But you probably won’t really use it comfortably in production until ~2032.

                      Absolutely understood!

                      1 Reply Last reply
                      0
                      • Kent-DorfmanK Kent-Dorfman

                        Doesn't anyone have any esoteric C++ incantations to discuss. It's too quiet in here.

                        J.HilkJ Offline
                        J.HilkJ Offline
                        J.Hilk
                        Moderators
                        wrote last edited by J.Hilk
                        #13

                        @Kent-Dorfman

                        let me blow your mind!

                        int main ()
                        {
                            std::println("Hello World");
                        }
                        

                        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                        Q: What's that?
                        A: It's blue light.
                        Q: What does it do?
                        A: It turns blue.

                        JonBJ Kent-DorfmanK 2 Replies Last reply
                        0
                        • J.HilkJ J.Hilk

                          @Kent-Dorfman

                          let me blow your mind!

                          int main ()
                          {
                              std::println("Hello World");
                          }
                          
                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote last edited by
                          #14

                          @J.Hilk
                          Looking this up it says std::println() is C++23. Is C++23 not really a "thing", hence it won't appear until C++26?

                          J.HilkJ 1 Reply Last reply
                          0
                          • JonBJ JonB

                            @J.Hilk
                            Looking this up it says std::println() is C++23. Is C++23 not really a "thing", hence it won't appear until C++26?

                            J.HilkJ Offline
                            J.HilkJ Offline
                            J.Hilk
                            Moderators
                            wrote last edited by
                            #15

                            @JonB :P

                            fair, but thats like only 6 month more


                            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                            Q: What's that?
                            A: It's blue light.
                            Q: What does it do?
                            A: It turns blue.

                            1 Reply Last reply
                            0
                            • J.HilkJ J.Hilk

                              @Kent-Dorfman

                              let me blow your mind!

                              int main ()
                              {
                                  std::println("Hello World");
                              }
                              
                              Kent-DorfmanK Offline
                              Kent-DorfmanK Offline
                              Kent-Dorfman
                              wrote last edited by
                              #16

                              @J.Hilk said in I hear crickets chirping:

                              @Kent-Dorfman

                              let me blow your mind!

                              int main ()
                              {
                                  std::println("Hello World");
                              }
                              

                              I wouldn't use it anyway. I prefer iostreams. ;^)
                              One of my great fears is that I'll wake up some day and they will have deprecated them.

                              At a previous company they hired a guy I asked them no to, and I made the mistake of asking him to create or find a preexisting streams based logger class similar to syslog function and to implement manipulators so we could modify log level and output destination. He then started a multi-week campain to convince me why streams are a terrible idea and that we should have nothing to do with them. std::println() is something he would have liked.

                              1 Reply Last reply
                              0
                              • GrecKoG Offline
                                GrecKoG Offline
                                GrecKo
                                Qt Champions 2018
                                wrote last edited by
                                #17

                                And he was correct about that.

                                Kent-DorfmanK 1 Reply Last reply
                                0
                                • GrecKoG GrecKo

                                  And he was correct about that.

                                  Kent-DorfmanK Offline
                                  Kent-DorfmanK Offline
                                  Kent-Dorfman
                                  wrote last edited by
                                  #18

                                  @GrecKo said in I hear crickets chirping:

                                  And he was correct about that.

                                  will agree to disagree. will do whatever I can to avoid pythonizing c++, or making it look like a java clone.

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    SimonSchroeder
                                    wrote last edited by
                                    #19

                                    On the one hand, I really like the new formatting syntax. It is especially helpful if you want to have translations inside your source (single string with placement of the arguments). But, it was so much easier to implement an operator<< for your own type than it is for fmt. Sure, there are some inefficiencies in the streams we cannot get rid off without breaking a few pieces of code (something related to locales, if I understand this correctly). There is still nothing better than streams for a generic interface for input and output. I have written a couple of classes that work on input and output streams, e.g. a class that computes a CRC32 on the fly while reading or writing a stream. It just adapts to another stream and is a drop in replacement where the stream would be used before. The new stuff is only about formatting, but not about composability. I'm still not sure where I am going to land concerning streams versus fmt.

                                    @J.Hilk: Your hello world example won't compile. You forgot the import std; 😉

                                    JonBJ 1 Reply Last reply
                                    0
                                    • S SimonSchroeder

                                      On the one hand, I really like the new formatting syntax. It is especially helpful if you want to have translations inside your source (single string with placement of the arguments). But, it was so much easier to implement an operator<< for your own type than it is for fmt. Sure, there are some inefficiencies in the streams we cannot get rid off without breaking a few pieces of code (something related to locales, if I understand this correctly). There is still nothing better than streams for a generic interface for input and output. I have written a couple of classes that work on input and output streams, e.g. a class that computes a CRC32 on the fly while reading or writing a stream. It just adapts to another stream and is a drop in replacement where the stream would be used before. The new stuff is only about formatting, but not about composability. I'm still not sure where I am going to land concerning streams versus fmt.

                                      @J.Hilk: Your hello world example won't compile. You forgot the import std; 😉

                                      JonBJ Offline
                                      JonBJ Offline
                                      JonB
                                      wrote last edited by
                                      #20

                                      @SimonSchroeder
                                      If you want to be picky, it presumably won't compile with warnings -> errors as the int function does not return anything ;-)

                                      J.HilkJ 1 Reply Last reply
                                      0
                                      • JonBJ JonB

                                        @SimonSchroeder
                                        If you want to be picky, it presumably won't compile with warnings -> errors as the int function does not return anything ;-)

                                        J.HilkJ Offline
                                        J.HilkJ Offline
                                        J.Hilk
                                        Moderators
                                        wrote last edited by
                                        #21

                                        @JonB since C++11 int main() has, as the only case in the whole standard, an implicit return value and not writing your own return 0 is completely valid.

                                        Do not flame on me, I do not agree with this decision


                                        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                                        Q: What's that?
                                        A: It's blue light.
                                        Q: What does it do?
                                        A: It turns blue.

                                        JonBJ Kent-DorfmanK 2 Replies Last reply
                                        2
                                        • J.HilkJ J.Hilk

                                          @JonB since C++11 int main() has, as the only case in the whole standard, an implicit return value and not writing your own return 0 is completely valid.

                                          Do not flame on me, I do not agree with this decision

                                          JonBJ Offline
                                          JonBJ Offline
                                          JonB
                                          wrote last edited by
                                          #22

                                          @J.Hilk Really? That's ridiculous! It's a non-void function, so it needs a return, simplez ;-)

                                          J.HilkJ 1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved