Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
andreasfertig ( andreasfertig@programming.dev )  to C++@programming.dev · 1 year ago

Efficient C++: The hidden compile-time cost of auto return types

andreasfertig.com

external-link
message-square
12
link
fedilink
12
external-link

Efficient C++: The hidden compile-time cost of auto return types

andreasfertig.com

andreasfertig ( andreasfertig@programming.dev )  to C++@programming.dev · 1 year ago
message-square
12
link
fedilink
In today's post, I would like to dive into writing efficient C++ code. As you probably know, one post will not cover this entire topic....
  • Kairos ( LodeMike@lemmy.today ) 
    link
    fedilink
    arrow-up
    3
    ·
    1 year ago

    Why the fuck do people do this to themselves.

    • Lembot_0004 ( Lembot_0004@discuss.online ) 
      link
      fedilink
      arrow-up
      4
      ·
      edit-2
      1 year ago

      deleted by creator

      • Kairos ( LodeMike@lemmy.today ) 
        link
        fedilink
        arrow-up
        3
        ·
        1 year ago

        Nuter one of the main reasons for headers: documentation.

        • entwine ( entwine@programming.dev ) 
          link
          fedilink
          arrow-up
          2
          ·
          1 year 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 ( LodeMike@lemmy.today ) 
            link
            fedilink
            arrow-up
            1
            ·
            1 year 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.

    • DapperPenguin ( DapperPenguin@programming.dev ) 
      link
      fedilink
      arrow-up
      3
      ·
      1 year 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 ( bitcrafter@programming.dev ) 
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

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

C++@programming.dev

cpp@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !cpp@programming.dev

The center for all discussion and news regarding C++.

Rules

  • Respect instance rules.
  • Don’t be a jerk.
  • Please keep all posts related to C++.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1 user / day
  • 4 users / week
  • 35 users / month
  • 97 users / 6 months
  • 13 local subscribers
  • 2.38K subscribers
  • 344 Posts
  • 419 Comments
  • Modlog
  • mods:
  • farados ( farados@vlemmy.net ) 
  • Nihili0 ( Nihili0@programming.dev ) 
  • lysdexic ( lysdexic@programming.dev ) 
  • BE: 0.19.15
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code