Settings

Theme

The case against Almost Always auto in C++

gist.github.com

5 points by alberto-m 4 months ago · 3 comments

Reader

throwawayffffas 4 months 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-mOP 4 months 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 4 months 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.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection