r/cpp • u/anonymous23874 • Apr 19 '20
Default function arguments are the devil
https://quuxplusone.github.io/blog/2020/04/18/default-function-arguments-are-the-devil/
90
Upvotes
r/cpp • u/anonymous23874 • Apr 19 '20
View all comments
Show parent comment
2
u/cat_vs_spider Apr 19 '20
Stupidity does find a way, but I think default parameters are a feature that exist pretty much to facilitate stupidity. In my experience, they are always used to bolt some new behavior onto a new function that everybody is used to working a certain way, thereby pulling the rug out from under them. And since they must be the last arguments, they result in function arguments not being organized in a clean way (fungus growth pattern). And god help you if you want to customize the fifth default argument.