The case against Almost Always auto in C++

(gist.github.com)

2 points | by alberto-m 7 hours ago ago

3 comments

  • throwawayffffas 7 hours ago ago

    This looks like a tooling issue to me.

    The reason auto exists is because the type can be trivially infered.

    Your editor should be able to show you the types.

    • alberto-m 6 hours ago ago

      1. GitHub does not show me the types.

      2. To show me the types my editor requires me to, in the best case, hover the mouse over the keyword, which is 100x slower as moving my eyeballs. In the worst case it additionally takes several seconds to compute the type (my shop uses metaprogramming heavily).

      • throwawayffffas 6 hours ago ago

        To each their own, I come from the land of dynamic typing and writing down types is the bane of my existence, especially when they can be inferred.

        2. Type annotations are always on on VScode for rust in places they are omitted. There must be a setting in your editor to show you the types without highlighting. It might take a bit to load at startup though.