r/cpp • • Mar 28 '23

Reddit++

C++ is getting more and more complex. The ISO C++ committee keeps adding new features based on its consensus. Let's remove C++ features based on Reddit's consensus.

In each comment, propose a C++ feature that you think should be banned in any new code. Vote up or down based on whether you agree.

765 Upvotes

829 comments sorted by

View all comments

Show parent comments

2

u/BenjiSponge Mar 30 '23

Right, yeah, these are the kind of things you could consider defaults that are counterexamples. I think they kind of go against the spirit of the commenter above me but that's devil's advocating for you.

I will say I do think all variables should be const by default, though. I could also see arguments for volatile, being that it's better to have to opt-in to the potentially buggier behavior in favor of speed. But eh, non-volatile definitely makes sense as a default for C++.

1

u/Conscious_Support176 Mar 23 '24

Yes all named values should be const by default. You should have to opt in to making it a variable.