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/
90 Upvotes

149 comments sorted by

View all comments

Show parent comment

1

u/khleedril Apr 19 '20

I know this is meant as an example for the argument and not real code, but if I saw this in the wild I would be asking myself why should a square default to 10x10? And why should the default filler be '+'? If there are reasons in the application domain, then I would seek to embed those reasons in the function names, and avoid overloads and default values. Otherwise, I would just not assume default values.