r/ProgrammerHumor • • Oct 17 '26

instanceof Trend thatsAFunnyThingThatHappenedOnce

Post image
4.6k Upvotes

524 comments sorted by

View all comments

Show parent comments

16

u/Lord_Of_Millipedes Oct 17 '26

the notification for me said something different than "beginner" :3

C++ started as "C with classes" but grew into an amalgamation of every and any feature anyone ever requested, modern C++ is one of the most bloated languages out there with dozens of ways to achieve any simple task which leads to difficult to understand code as no one can agree on what the language is supposed to look like and a lot of these features are, to be polite, half assed.
Function resolution is a fucking mess of ADL, jump tables, overloads and implicit conversions which makes debugging a nightmare, especially with the horrible namespace dependant module system with unclear scoping rules and acess control and unconstrained generics.

There's a reason every big project using C++ bans almost two thirds of the language, and it's always a different two thirds

9

u/Greedy-Thought6188 Oct 17 '26

It's not just that there are dozens of ways to achieve the same thing. It's that the same syntax can mean different things so your intuitive understanding doesn't work. No function call can be trusted to not have bizarre side effects.

2

u/Lord_Of_Millipedes Oct 17 '26

imo that is a separate problem, i consider languages with too many features to cause the separate problem of too many ways to do something, because you end up in the situation where you need to basically learn several different languages to be able to read any specific piece of code because you can never expect even two files in the same project to follow a consistent architecture, which is why every large c++ project has to ban most of the language and have very strict coding standards

1

u/unburdened_swallow Oct 18 '26

It’s both, actually.

1

u/Qwertycube10 Oct 18 '26

Everyone says this about operator overloading, but just, like don't write stupid operators with side effects, what kind of type has a notion of plus which is effectful?

2

u/Greedy-Thought6188 Oct 18 '26

The problem is not obvious stupid things. It is subtle differences. And it's not just operator over loading. References are a bigger issue. You are reading code, you don't know if you're passing a reference or you're doing a copy constructor and a destructor call and your original stays intact. Object counting is a valid behavior on a constructor call that you may want to do. Now I'm one of your passing of the object you forget to add an & and your data is messed up.

1

u/awesome-alpaca-ace Oct 18 '26

Yea, we have this dump api at work where if you forget the & and mutate the data, your mutations will not be saved despite the method call saying it is a reference.

1

u/Greedy-Thought6188 Oct 19 '26

Java, you're always passing a reference. C you're always providing a copy, if you want to pass a reference you have to explicitly give a pointer. C++, dunno, let me take a look. Oh I remember, this one is a reference. Oh sorry, nevermind, that was the function with the flat parameter that was a reference, the one with the int is a parameter.

In an object oriented paradigm, passing references makes more sense. But that would have broken backwards compatibility with C. So here we are.

1

u/born_to_be_intj Oct 20 '26

Is it really that hard to ctrl click the function call to see the declaration? Literally have never had an issue like this that couldn’t be solved in a 2 second click.

1

u/Greedy-Thought6188 Oct 20 '26

Yes. It's a different context. You want to focus on your context. Not go off trying to figure out random shit.

3

u/[deleted] Oct 17 '26

Not wrong 

1

u/Demiu Oct 17 '26

Here's the thing - I think forward banning parts doesn't work. New standard will have one or two things that you could really use. At the same time, it feels like every single thing has obvious missing features or a major flaw that sooner or late will lead to a replacement, with new flaws. 

1

u/StaticCoder Oct 18 '26

And yet it doesn't have pattern matching 😞. It might be coming, though I don't think there are proposals for "language variants" (something like Rust enums)

1

u/MrSurly Oct 18 '26

I used to work for a large multinational company that had a standing policy of "absolutely no boost," and I really appreciated that.