• HiddenLayer555@lemmy.ml
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      8 hours ago

      Why would anyone bother writing it like that? That just seems like int main() with extra steps. Like does auto enable some compiler optimisation of the return type that I’m not aware of?

      • Sonotsugipaa@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        2
        ·
        7 hours ago

        Defining the return type that way can be used when dealing with template sorcery - there’s no use for it here though, not even for readability in any way.

          • Feyd
            link
            fedilink
            arrow-up
            1
            ·
            5 hours ago

            They’re useful for templates because the trailing version is resolved later

          • _____@lemm.ee
            link
            fedilink
            English
            arrow-up
            3
            ·
            9 hours ago

            because explicitly declaring types can be redundant, if the compiler knows a lot of the times you should also know

            also because some types are extremely cursed: see std views/ranges