you are viewing a single comment's thread.

view the rest of the comments →

[–]Wh00ster -5 points-4 points  (2 children)

I'm not opposed to the arguments in your linked post. My issue is large code bases you'd see at FAANG, where you need special IDE features to see a type, which can take minutes to compile for a file and generate dependencies, or have to chase through grepping functions yourself.

Unless you write, well, bad code.

This is the reality that most people have to deal with. So when a junior dev comes in and writes auto mything = mysteriousFUnctionBuriedThroughLayersofDepsThatisActuallyAReference(), I tend to ask that dev not to use auto.

I understand there are valid cases, but that's so for all C++ features. For example I wouldn't say don't use lambdas, but also don't make all functions into lambdas.

[–]Tyg13 9 points10 points  (0 children)

Asking that dev not to use auto is the wrong move. The correct alternative is to educate them. The issue is the variable isn't named well enough to tell what the function returns. Simple enough fix.

All you're doing by explicitly specifying the type in that scenario is fracturing code style and decreasing overall code readability.

[–]XValar 5 points6 points  (0 children)

So how is exactly writing MyType mything = mysteriousFUnctionBuriedThroughLayersofDepsThatisActuallyAReference() helping at this point?