r/cpp • • Apr 19 '20

Default function arguments are the devil

https://quuxplusone.github.io/blog/2020/04/18/default-function-arguments-are-the-devil/
92 Upvotes

149 comments sorted by

View all comments

Show parent comment

-3

u/Wh00ster Apr 19 '20 edited Apr 19 '20

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.

6

u/XValar Apr 20 '20

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