• lad@programming.dev
    link
    fedilink
    English
    arrow-up
    11
    ·
    edit-2
    6 months ago

    Summary

    If you want fast compile times, be careful with functions using auto as a return type in header files.

      • DapperPenguin@programming.dev
        link
        fedilink
        arrow-up
        3
        ·
        6 months ago

        From my discussion with C++ folk, auto is just part of the “modern” way of doing c++. Paired with the -> return type. Perhaps including that -> return type negates this problem? It’s still strange to me. Feels more like Rust

        • bitcrafter@programming.dev
          link
          fedilink
          arrow-up
          2
          ·
          6 months ago

          One day the use of auto will grow so extensive that modern Python code will have more type annotations than modern C++ code!

          • entwine@programming.dev
            link
            fedilink
            arrow-up
            2
            ·
            6 months ago

            I think you’re conflating regular auto use with using it as a return type/argument. The latter is syntactic sugar for declaring a template. It isn’t any less “documented” than doing a template<class ReturnType>....

            • Kairos@lemmy.today
              link
              fedilink
              arrow-up
              1
              ·
              6 months ago

              Having the return type name is absolutely better documented. But I guess were splitting hairs because its a hard typed language and lexers can find what it is anyway.