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/somecucumber Apr 19 '20

Sorry if I was rude in my previous reply. I did not mean to troll or anything, just create debate. But again this is my personal opinion and, according to the downvotes, it seems I'm wrong.

Genuine question. goto and the default parameters come from C, right? Some othe people complain about that keeping backwards compatibility is an error and I agree, but for some reason this issue does not apply here.

I don't know what to think?

7

u/Nobody_1707 Apr 19 '20

C has never had default arguments. It's a pure C++ feature.

2

u/somecucumber Apr 19 '20

Argggh, not my day. You're right.

1

u/be-sc Apr 19 '20

No need to appologize for anything. I gave a genuine answer.

Imo backwards compatibility is a major factor for C++’s overall success, so no, in general keeping it is not an error.

However, “legacy” features are not created equal. At this point I’d guess that goto has had its devestating reputation for so long that removing it from the language would lead to relatively minor disruption. At least compared to removing default function parameters – those’re used all over the place in both old and new code.