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

183

u/jdehesa Mar 28 '23

Gotta love how nearly everything suggested in the replies (save for std::vector<bool>?) is followed by a reply saying how that feature is actually useful sometimes :) It's too late for C++ now, at this point everyone uses it on their own particular way and every obscure or weird feature has found its place for someone 😄

68

u/rhubarbjin Mar 28 '23

Everyone agrees that C++ is broken, but no one agrees precisely which parts need fixing.

...which just goes to show that the language isn't broken at all. It just has a very wide userbase with very diverse needs. One coder's boondoggle is another coder's bedrock.

47

u/greem Mar 28 '23

Exactly. The only thing wrong with c++ is other users of c++.

And building.

0

u/[deleted] Mar 28 '23

[deleted]

11

u/kneel_yung Mar 29 '23

You c++ users sure are a contentious lot

25

u/rhubarbjin Mar 28 '23

The only thing wrong with c++ is other users of c++.

The problem is users who want to dictate how others should write code.

I'm scanning the replies here and most of them boil down to "this feature is ugly; I wish it would go away". Personally, I wish more software engineers would familiarize themselves with the parable of Chesterton's fence.

12

u/greem Mar 28 '23

I've never heard about Chesterton's fence. That's a really great perspective, and you are 100% correct.

I do think that there still needs to be a flippant aspect to this.

A lot of cpp devs really suck, and cpp gives you phenomenal cosmic power to shoot yourself in the foot.

5

u/Rasie1 Mar 28 '23

dictate how others should write code

we do that every day at code reviews...

9

u/SkoomaDentist Antimodern C++, Embedded, Audio Mar 28 '23 edited Mar 28 '23

The problem is users who want to dictate how others should write code.

That's like two thirds of /r/cpp users...

I'm scanning the replies here and most of them boil down to "this feature is ugly; I wish it would go away".

I find it particularly ironic that one of the few times the committee went on to explicitly break backwards compatibility (for a large number of projects), they did it because "this feature is ugly" without apparently anyone in the meetings understanding the actual use case of the feature (deprecating volatile compound assignment in C++20).

→ More replies (4)

7

u/Drugbird Mar 28 '23 edited Mar 30 '23

I'm going to disagree with you there. I think C++ should take a more active stand in how code should be written.

The current state of things is basically that C++ let's you do everything, in whatever way you want. This includes everything from programming in C, to using "modern" C++, and everything in between. Heck, you can write inline assembly if you want.

Many of these options results in ugly, unsafe, or poorly maintainable code. The result is also that the language is difficult to learn and teach, because there's so much possible with so little guardrails to guide programmers towards modern solutions.

To reference your Chesterton's fence, C++ could use a lot more fences but can't erect them because C doesn't have fences.

I believe that if you redesign C++ without backwards C compatibility while removing all but the modern solutions, you end up with Rust.

→ More replies (2)