47 ms·
> If it's so easy to reason about, why can't you just state the type of the variable? because : - easy to reason about and easy to type are two differents thi
by jcelerier 8y ago
> If it's so easy to reason about, why can't you just state the type of the variable?
because :
- easy to reason about and easy to type are two differents things
- naming everything increases mental load
> Use of the auto keyword avoids doing that and as a result enables you to create new and exciting bugs in your code.
to the contrary, porting a lot of my code to use almost-always-auto did actually remove bugs in the form of silent type conversions happening - e.g. std::pair<std::string, int> instead of std::pair<const std::string, int> (yay memory allocations), bad fp conversions...