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 1.4k 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.
  • 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
      • JonBJ JonB

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

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

        @JonB
        Untitled.jpg


        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
        1
        • 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

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

          @J.Hilk said in I hear crickets chirping:

          @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

          Nor do I. Hidden or implicit actions are not a good thing.

          I wonder what would happen if you explicitly define

          void main() {}

          Since the startup code only cares about the symbol, not its type.

           c++ test.cc 
          test.cc:15:1: error: ‘::main’ must return ‘int’
             15 | void main() {
                | ^~~~
          
          

          Well, there you have it.

          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.

            S Offline
            S Offline
            SimonSchroeder
            wrote last edited by
            #25

            @Kent-Dorfman said in I hear crickets chirping:

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

            Change of topic: I recently found some esoteric C++ incantations: a constexpr counter based on template instantiation: https://b.atch.se/posts/constexpr-counter/ . However, it seems that this behavior is about to be deprecated (you cannot rely on the order templates are instantiated). At the same time, something quite similar has occured in one of the reflection examples (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2996r12.html Chapter 3.17 "Compile-Time Ticket Counter"). This reflection proposal has been accepted, so we might be able to safely do a constexpr counter through reflection starting with C++26.

            1 Reply Last reply
            1

            • Login

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