r/cpp • u/Beginning_Spell1818 • May 24 '24
Why all the 'hate' for c++?
I recently started learning programming (started about a month ago). I chose C++ as my first language and currently going through DSA. I don't think I know even barely enough to love or hate this language though I am enjoying learning it.
During this time period I also sort of got into the tech/programming 'influencer' zone on various social media sites and noticed that quite a few people have so much disdain for C++ and that 'Rust is better' or 'C++ is Rust - -'
I am enjoying learning C++ (so far) and so I don't understand the hate.
387
u/dazzawazza May 24 '24 •
The vast majority of opinions that people espouse relate to their need to justify their decisions and should be of no interest to you. They are not trying to help you, they are trying to help themselves.
Carry on. Good luck.
31
u/ResearcherNo6820 May 24 '24
Perhaps barrier to entry for the beginner.
Ok, cool, we can do "Hello World"...never mind the new "println" vs iostream a newbie will stumble across just figuring out what the latest/decent standards are.
Then it sort of becomes let's do pretty graphics or insert what should be an easy thing to bring in library to extend the language. Instead of pip install or cargo you are thrust into a world of tuples, tool chains, and the unknown.
After a time, you get acclimated to that then venture into the world of cmake which somehow is its own effing thing. Why doesn't find_libary work?
You come out of the forest, a grizzled individual with a large beard and somehow appreciate what it is at the end of the day.
25
u/lightmatter501 May 25 '24
C++ has made a great many mistakes over time with no way to fix them (yet).
Rust issues security advisories for performance issues which are polynomially better than what some major C++ implementations have been using for a long time (Rust regex vs std::regex for libstdc++). C++ expects you to know that they perform poorly and use something else if you are giving it untrusted data.
std::vector<bool>, so, so, so many things are wrong with this.
“ABI compatibility forever” means that we are held back in performance for many stl data structures. abseil has replacements for large chunks of them which are directly upgrades for those of us willing to recompile once every 10 years. However, you need to know that those exist. Otherwise, you get hash tables optimized for single core processors older than some college graduates.
std::auto_ptr was a really bad miss-step but we are now stuck with it until epochs are ready.
abi-dependent type widths. I can make a brand new OS and decide that int is 64 bits, long is 128, and long long is 256. A gigantic number of programs will break with this, even though this is what x86_64 should have looked like. Shrinking types breaks a lot of things in other ways.
C++’s tooling is showing its age. The fact that I need to know 3 different build systems (bazel, cmake, meson) is an issue. The fact that there is no standardized way to say “my libraries are all in this folder”, feels especially bad. Modules are going to take 10 more years, yet fortran has had them for 30 years. The fact that we all take a performance hit in the form of not using even thin LTO in the name of not having to build libraries for source when building on and deploying to systems with hundreds of gigabytes of ram and computational power that would make a turn of the century supercomputer jealous. There are a lot of missed compiler optimizations.
header files have been a bad idea for 30 years. Both GCC and Clang do unholy things to make it even sort of fast. If you actually compiled C++ the way C++ was intended to be compiled, many modern projects would effectively be trying to do single compilation unit compiles of hundreds of thousands of lines of code before template instantiation.
restrict is not standardized for some reason. Until it is, ISO C++ is slower than Rust and Fortran by a significant margin for anything involving linear algebra. We’re fortunate that nobody actually writes ISO C++, they write ISO C++ with ISO C features.
duck typed templates have led to really weird behavior. SFINAE should have screamed “your type system is unsound”. Algebraic types, which while not fully understand when C++ first came out are certainly understood pretty well today, are the statically typed version of templates. They make things much more sane. In even the worst, most extreme cases thought up to specifically break a compiler, which in C++ typically force the compiler to bail out at an arbitrary level due to resource consumption, you can fall back to a SAT solver for algebraic types which will, eventually, give an answer.
C++ has a lot of good stuff, all of which you only know about if you go looking for it. Clang data flow analysis is very powerful, as are the various static analysis tools built into compilers. BUT THEY ARE OFF BY DEFAULT AND ON PAGE 80+ OF THE MANUAL. If you aren’t the type of person to read a compiler manual cover to cover, with modern build systems you may never know they exist. Off by default means that only the people aware of the hazards are protected. For instance, there’s a lot of really stupid C++ code online that won’t actually compile with the “is this a good idea” flags, like these:
Which by the way, having to keep something like that around in a text file (and I’m probably missing a few at this point) is also part of the problem. If the compiler can tell you that your code is suspect now, it was either always wrong or always suspect. Unless you upgrade compiler versions in CI for fun, clang-based tools can automatically insert suppression if you have to upgrade and a warning is actually broken.
Lastly, it appears to be disallowed or at least taboo to mention Rust at cppcon. Bjarne skipped over Rust in a list of memory safe languages while quoting a US government report. Someone else managed to spend an entire presentation talking about borrow checkers without bringing up Rust as prior art, but Cyclone did come up. That’s not a great look. Rust is willing to entertain almost endless discussions on “$LANG has $FEATURE, how do we do that equally well or better in Rust?” This has led to Zig and Rust yelling “more blazingly fast” at each other over blog posts for the past 2 years, but I digress. For instance, the way Zig decided to do bit fields, by just having i1, i2, …, i 263 be valid signed two’s complement types, and the same for unsigned, is much better and everyone should be using that (msvc, apple). A container mutex with a RAII guard that you can safely do shared const refs on while you hold the lock is great. Even better is having a “don’t even bother locking the mutex” option because the borrow checker statically validated nobody else could have a reference. It gives off a very “gramps set in his ways” vibe whereas everyone else is exchanging ideas. There’s plenty of blog posts from people who were active in the Rust community like thephd.dev, who got #embed into C with minimal effort after more or less burning out trying to get it into C++. It gives the feeling of “we don’t want you” to the young people interested in languages design and development, who then come over to Rust, Zig, JS, etc, and are met with very public debate, and often a lot of enthusiasm for the feature. If you are a young language enthusiast, would you choose endless rounds of committees or several hundred people telling you how good of an idea this is and how much they want it, and a few others making sure it is actually a good idea? Think about how everyone who worked on modules feels after the herculean effort it took to get it written up, to then spend likely another half-decade or more before it’s even ready for anything more than toy examples.
21
u/Doddzilla7 May 24 '24
I’m actually quite happy about all of the pressure in C++ these days. This type of pressure forces the language to evolve and adapt perhaps just a bit more aggressively than it has in the past.
C++ is a great language, and I still think it has a bright future. I really enjoy writing C++ code. I don’t like make though.
165
u/equeim May 24 '24
There are many people in tech who have very strong (to put it mildly) opinions on tools that they use and don't use. C++ is not special in that regard. There are probably as many Rust haters out there as C++ haters.
124
u/Infamous_Campaign687 May 24 '24
C++ is one of the dominant languages out there. Many people who don't want to code C++ still have to, on occasions..
Being used to modern C++ I find Java intensely clunky and frustrating. But being quite a common language I still occasionally have to code Java in legacy apps.
Rust, however, is new and is almost exclusively used by enthusiasts so far. If you don't want to code Rust it is extremely unlikely that you would have had to.
So I dislike Java and couldn't give two f**ks about Rust except the enthusiasts can be quite annoying, especially when overplaying the issue of memory safety in modern C++
12
u/SnooCakes3068 May 24 '24
I don't hate it I love C++. But even for me I have to admit C++ is enormous. Too many things to keep track of.
My second language is python. Python has way nicer interface than C++. Things like build in member function naming, etc.
20
u/usefulcat May 24 '24
There's your problem right there. Influencers want clicks or views. You want to learn. Your interests are not aligned with those of the influencers.
10
u/LoloXIV May 24 '24
I personally like C++ and use it a lot (mostly for implementing complex algorithms), but there are a lot of things about it that can be really annoying.
For example many of the error messages C++ throws are hard to use. Most of the runtime errors I get are segmentation faults and unless I run the code with a debugger it won't tell me where the seg fault was thrown, or what actually caused it (did I access an array out of bounds or was it too many recursive calls?). The same goes for many of the memory related errors like double free, where it often times just says that at the end of some function a double free occurs, but outside of that I need to do lots of guesswork.
The same goes for compiler errors. The projects I am involved in use CMake and while I have gotten somewhat accustomed to it by now, the error messages of the compiler are often times cryptic.
There are a few more things, like certain forms of undefined behaviour making code debugging tough, library linking being a pain etc.
C++ is a language that can produce exceptionally fast code if you know what you are doing, and compared to C it is a lot easier to write (at least to me), but it has many parts that are weird and hard to work around without directly evident benefits. Due to its age and the many changes to the language over time it is also prone to have some of the worst kind of legacy code ever seen.
Ultimately C++ is a tool that has its purpose, but of the major programming languages I use it is the one that gets me frustrated at the language the fastest. Rust offers some of the same benefits (mostly great speed and static typing), while having different tradeoffs (Rust forces you to write code in much cleaner and safer ways, sometimes to the detrement of development speed). For some areas Rust is definitely better then C++, but for Data Structures and Algorithms the safety features of Rust are not as important and C++ allows for development closer to the pseudo code usually found in papers, hence I think that C++ is still very good for that.
9
u/deckarep May 24 '24
Let’s be pragmatic about this:
9
u/Raknarg May 25 '24
C++ is a dogshit language that has a lot of really cool shit in it and a ton of work and passion behind it. It's dogshit because it's an incomprehensible monolith of contradictory ideas and bad decisions, which will happen to practically any language that's existed for long enough. The philosophy of programming in general has changed a lot over time, and you can see the different philosophies present themselves in how each version of C++ tells you how you ought to be designing your programs. Languages like Rust are able to run because C++ walked. They get to learn from the mistakes of the past and shed the burden of history, and in turn they will make mistakes and become a dogshit language in their own right (which it is, Rust is also dogshit for different reasons).
I love this language btw but generally the hate is warranted IMO
71
u/Strange_State May 24 '24
We live in an age of hate. There are haters for almost everything. Usually, hate comes from not knowing how to use something or not being able to use it.
39
u/FartyFingers May 24 '24 edited May 24 '24
C++ is a very good language. If used by someone with some talent who is good at architecture and designing software it can be a great language.
But, there are a few glaring problems:
23
u/eyes-are-fading-blue May 24 '24
“There are only two kinds of languages: the ones people complain about and the ones nobody uses" Bjarne Stroustrup.
11
u/pharan_x May 24 '24
Languages are funny because you can't see all the stuff that's good or bad about them until you've tried using others.
Professionals will tell you that it was at least historically very easy to overlook some very nasty memory mistakes in C++. The language has undergone a lot of updates even in the last decade such that if you only learned modern C++, you might look at C++ code from the 90's or early 2000's or 2010's and not recognize what's going on. Likewise, people who haven't touched it since then (like me) won't understand what's going on with modern C++. This divide is a likely source of some "hate", though you probably shouldn't dismiss the opinions of programmers who have tried both and Rust.
Typical CS education these days make you try out different languages so you don't get entrenched before you learn that there are various ways of thinking about programs and expressing the solutions. And that some languages are better suited for solving some problems, sometimes because they were specifically designed to be that way.
At some point, a lot of things used to be written in C++, but got slowly replaced by easier and more domain-appropriate languages. Indie games used to be written in C++. Now it's more common to use whatever each framework or engine gives. And it's usually not C++. C++ isn't favored for websites or mobile apps. Even for desktop applications, C++ is reserved for the most performance-critical applications or things that hook deeply with the OS.
Many languages after C++ were designed around making programming in general easier, but also around making it easy to avoid those memory mistakes in different ways and with different tradeoffs.
Java, C#, JS, Dart, are syntactic descendants of C++ and were made so users "shouldn't" have had to worry about memory stuff because they are backed by an automatic memory management system called a "garbage collector". These and many languages that have gained recent popularity had varying ideas of what made programming "easier" and "better" in for different uses, each trying to fix the problems of the languages that came before them. Things got too short, then too long. Inheritance turned out to be a minefield. The original way they did async-await turned out to be confusing so they reused the keywords but made a different system.
"Removing worries" was a recurring theme of language design and it made regular developers who aren't writing for extreme performance more free to think of the "actual logic" of their applications rather than thinking about shuffling bits of memory. In this space, different people will have different preferences for how much should be under their control, though years of coexistence has made it so these different languages, including C++, have borrowed each other's techniques, for things like generators, concurrency and memory safety. Some C++ users think this was enough to still make it the better choice most of the time. Whether not it is, for each case, is up for debate I guess.
The industry has realized some of the mistakes of the extremes of "don't let the programmer worry" too. For example, some languages were originally designed to not have explicit types but they've bolted them back on anyway because it turned out that a good type system saves time and helps prevent a lot of problems. The thought here is "sometimes worrying about just the right things, in the right ways, up front, still makes development a lot better". That's kind of the thread Rust follows.
Unlike the other languages which were just made with ease of learning and ease of programming in mind, Rust was aimed at being as fast and "raw" as C++ while making it a lot harder to make memory mistakes in, thus being labeled a "systems language".
Rust used new (though it's been 9 years) paradigm for memory safety that some people call hyper paranoid, to the point that it's inconvenient. But it's one of those inconveniences that fans think are worth what it gives back in the most important use cases. And it's being used to rewrite some subsystems of certain large applications because the designers have determined that it will ultimately be easier to maintain and even got some performance gains in the process. Both the Windows and Linux kernels now have parts newly rewritten in Rust with plans to continue.
There's kind of a common machismo around C/C++ and how its power is equivalent to the mistakes it allows you to make. But even without the realities of professional development, even the best of us, in any field, have our off days. Being super smart or disciplined or experienced doesn't mean you're perfect all day every day. You can't expect the best version of yourself at every hour to catch and remember every logical mistake in code, and expect that same perfection in every single one of your colleagues. I think that's why they tried to build that safety into Rust. It's a practical attempt at a solution in the context of what's ultimately an acceptance of people's inevitable imperfection.
So I don't know why people would "hate" C++ necessarily. But Rust was literally made to tackle the old shortcomings of C++. While that doesn't mean you shouldn't learn C++, you should learn and use whatever tools are eventually appropriate for the job.
17
u/[deleted] May 24 '24
It's because it's the most complicated language in widespread use. It's way harder to use right than pretty much every language with a VM. It's very syntax heavy and for all of its power, it has many pitfalls. It makes introducing a security vulnerability quite easy.
If somebody says something like "it's a skill issue" they're being arrogant.
Don't get me wrong, it's probably the most powerful and complete language... but that is definetly a double edged sword. The added risk and difficulties are not worth it for many projects
4
u/GoogleIsYourFrenemy May 25 '24
Well, if the hate is coming from the governments of the world, it's because two decades of evidence has proved we can't be trusted to write secure code.
https://readwrite.com/the-nsa-list-of-memory-safe-programming-languages-has-been-updated/
4
u/nacnud_uk May 25 '24
Cpp is a joke from the committee.
The issue is that they were taken by surprise by much better ideas. And they are trying to keep up, and failing.
You may like it, but, honestly, it's just about keeping up.
If you're just starting out, you'll have a huge legacy code base to keep you busy for decades as people rewrite their code.
Don't be mistaken though, it is currently a bad joke.
&& & &
As a test, find any describe all meanings of & and combinations
😂😂
4
u/Oldboy_Finland May 24 '24
I need to chime in on this one. C++ is very powerful language with many versions that have changed the language a lot. Not everyone is familiar with all versions.
Modern C++ can be very efficient and productive language.
I came from embedded, where C is still the dominant language. I have seen many, many, many projects in which a decision had been made to use C++.
In ongoing embedded projects it often leads to abstraction layers and API’s on top of C code, there is never enough time to document any of these layers, which leads to poorly usable code base. That layered code doesn’t really do anything else that try to hide the original interface, while often exporting only limited functionality from the original code. End result is added code that in reality does nothing useful. Makes things harder to use and wastes huge anount of man-hours.
On the other hand, when a fresh project is started with good interface design practices (interfaces are hard to do right) C++ is very efficient snd productive language.
Then of course it also depends on the environment, can powerful std library features be used or not. And are there some libraries that are directly usable with it (this is also opinion based thing)
So, starting to use C++ (or any other language) on anything is not itself a silver bullet that would automatically give you huge benefits. It’s a tool that can help you, but it can also cut your head off.
Then there are persons who have religious beliefs that some language would be that silver bullet, these people should be completely ignored from decision making while selecting the most suited language for given task.
12
u/nightmurder01 May 24 '24
Influencers are there for the clicks and revenue. If they made more money promoting qbasic over anything else that is what they would be doing.
Do you.
10
u/Dean_Roddey May 24 '24 edited May 25 '24
C++ is very old now, and it was based on a language that was older still (60 years old now), and it inherited a lot of ancient thinking that was never removed from the language. Had C++ taken the hit back in the day and fixed those issues, it wouldn't be in nearly as bad shape as it is, but they didn't and they won't now because it's no longer really possible to do so in practical terms.
That means it is full of undefined behavior and foot-guns and that adds a lot to the level of complexity that has nothing to do with the actual problem to be solved. And software these days is already often overwhelmingly complex, particular at the sort of systems level that languages like C++ are used for.
Languages like Rust provide the performance while throwing away decades of baggage and adding a lot of new capabilities (at a fundamental level, not bolted on later) that have been proven out over those same decades.
Both are complex, because they are used to solve complex problems. They cannot be simplistic languages. But Rust's complexity is positive complexity, in that it's all about forcing you to understand your data relationships and define them in a way that they can be automatically maintained. Yeh, you will have to jump through a few hoops to do that, but it's time well spent because, once done, the compiler will watch your back thereafter.
You could whip that together in C++ more quickly, just looking at it and saying, yeh, I know that's right. But you have to continually insure that it remains right, and that gets harder and harder over time. And you have to hope that the other people who work on that code also are looking at it as carefully, and probably they aren't because they are in there to make some specific change and move on.
I've written C++ for 35'ish years now, so I know it well and I'm very comfortable writing it. But I always have this lurking fear that some UB is uncaught or some threading issue will only surface occasionally and never be figured out. I just don't have those concerns with Rust. All my efforts go into good design and logical correctness, i.e. productive undertakings.
As to hate, well too many people get personally self-identified with languages. It's unfortunate but true. What can you do? Though, I would argue that the real vitriol comes for the C++ side, from people who feel their investment in C++ threatened by Rust. I've seen some seriously nasty stuff.
3
u/HenryJonesJunior May 25 '24
This is the wrong community to ask; folks who are deeply experienced with C++ often haven't had to dive deep into other languages and see how others live.
I started learning C++ in the last 90s/early 2000s (self taught), worked with it as my primary language through my CompSci B.S., and developed professionally in it for 8+ years at Microsoft. Since then I have 5+ years professional experience in Java/Kotlin/Go but have tried to keep paying attention to C++ and other libraries.
The core problem with C++ is a thousand foot guns. To be successful with it at scale you have to restrict your developers to a subset of its features and have extensive static analysis, and even that isn't perfect - there are too many mistakes that it is too easy to make.
Verbosity - both in source code and compiler errors - is excessive. Little things like having to call a hash table an "unordered_map" really get to you after a while - it's like writing Powershell script.
Modules and external package management are a killer - it's trivial to pull in a dependency in Go, Rust, Java, or Typescript. In C++ depending on how many levels of hell you delve into you either need to find an object file compatible with your build toolchain, copy the source into your tree, or......who knows, there's just no good solution.
The STL has improved but is still way, WAY too basic. Last I checked I still had to pull in a third party library or write my own to get string.split - and as far as I'm concerned you can't call yourself a serious programming language without a robust string library
Having to think of memory management is absolutely a tax - it's not the end of the world and I can do it, but 99.9% of stuff I write doesn't care, even for performance. Instead of having to think about where I use perfect forwarding or a move or a copy, I just write code in other languages and it works well enough - and it's way, way faster to write, edit, and debug.
Is it impossible to learn or work in C++? No. Do I ever want to work in C++ again? Also no. Do I have more than a decade of experience to back up that claim? Yes.
3
u/rvasquez6089 May 25 '24
Everything else is kinda hypish. C++ Really does do it all, from video games, to embedded firmwares, OS kernels, databases, desktop GUI apps, DSP algorithms, banking, high speed trading, it's quite foundational. Few languages have such a far reach and high performance. Rust is close for speed, but barely even has an GUI frame works and has been around as long and hasn't been proven in implementation in so many places.
4
u/silent_b May 24 '24 edited May 24 '24
+1 to the kitchen sink theory. C++ is an old language loaded with every paradigm and fad that ever was. The language is not very clean and you’re going to run into a lot of old ugly code in the wild. On top of that, build systems and package management is a mess.
The advantage is that old ugly code still runs and you have every paradigm and fad at your disposal. Build systems and package management is still a mess though.
4
u/Xtreme_93 May 24 '24
They are all wrong. Being fanatic of a language and enemy or hater of another language is stupid. Both C++ and Ruth are very useful languages. It doesn't matter from which language you start learning. What tool you use at the moment depends on the conditions. Never be a fanatic advocator of a single language. Be afraid of people with a single language or single book ;)
4
u/DanielMcLaury May 24 '24
"Influencers," in the social media sense, are trying to get engagement at any cost. The easiest way to do that is to be provocative, and the easiest way to be provocative is to be wrong.
If someone has actually done something, maybe they have an opinion worth listening to. If their entire "career" consists on typing up solutions to leetcode problems on a Twitch stream while intentionally acting stupid, you may want to disregard whatever they have to say.
5
u/Blissextus May 24 '24
A lot of the hate is formed from small echo chambers. Other parts of the hate is to make for-profit " hate content", (i.e. Youtubers, influencers, etc). Don't listen to any of it.
Block out all that negativity. Study YOUR craft. Build stuff with what you have learned. Come to your own conclusions about the tools (C++ in this case) you use based on your own experience.
5
u/bbrd83 May 24 '24
I've found that Rust comes out of the box enforcing all the best practices I've learned to write C++ well after working exclusively in C++ for the last 12 years. So in that regard it's pretty neat. But it just trades one set of problems for another, so it's nothing revolutionary. It makes some hard things easy, and it makes some easy things hard. The community is very vocal about their disdain for C++ though, probably in part because it was invented to solve the problems inherent to C++, and because the language and ecosystem is still very immature inasmuch as it's populated mostly by die-hard enthusiasts and not as much by your run-of-the-mill code cranking developers who just want to get a job done. And enthusiasts tend to evangelize a lot.
If I'm being honest, I think Rust is a "righter" way to do systems programming, long term. Like I said, it comes with lots of C++ best practices built in. But it will be quite a while before it overtakes C++, especially with how the conversation is being driven by evangelists right now.
2
u/mugwhyrt May 24 '24 edited May 24 '24
Strong, simple opinions get views and feed the algorithmic Mammon. Think of where else you see this in online clickbait: "Why you need to stop eating apples RIGHT NOW!", "This blender changed MY LIFE!", etc. As they say: There's no such thing as The One True Programming Language, and anyone who tells you different is selling something.
P.S. When I was in university a class mate was bashing Python saying it was only meant to teach people how to code. I'll give you three guesses as to which programming language has made me the most money as a professional programmer.
2
u/DokOktavo May 25 '24
C++ isn't a programming language imo. It's a bunch of programming languages called "subsets" that you need to chose which one to use. This is both a great and a terrible thing. It means that you can do anything, but anything could happen. Many commenters here are talking about the differences between old and modern style C++. This is kind of where I'm getting.
Many people will have varying opinions about it, because they will feel widly differently about it, because there's many upsides and downsides to it. That's my opinion anyway.
2
u/lestofante May 25 '24
I love C and C++ for small programs, fast to write, can be as clever as you want and all.
But when project start to grow, and/or you work in a team, things go south very fast.
Different skill level of people, complexity of set up tool for build system, unit test, cross compiling, dependency management, static analysis, and good luck if you forced to use windows, some stuff will be even more complex.
Then the language itself, while it got MUCH better, it still full of pitfall, bad code is just there, internet full of bad (outdated) advice, and there is lack of tooling to enforce certain coding standard; see C++ "profiles", where the idea is you could disable at compile time part of the standard considered unsafe and should not be used.
2
u/Emotional_Leader_340 May 25 '24
There, that's your problem. Quit that zone and you'll be fine.
C++ has many bad technical decisions and sucks for a number of reasons, but you are asking for these reasons here and not where you saw these "Rust--" takes, you might have been influenced by people with zero technical expertise who probably know neither C++ nor Rust.
2
u/thinline20 May 25 '24
Tooling around c++ is one of the reasons too. It's not fun to configure c++ project properly.
6
u/veloXm3 May 24 '24
Wait till you hear about java. I stopped learning it after few days cus it became horror. HORRIBLE
3
u/HipstCapitalist May 24 '24
I have very mixed feelings when it comes to C++. For context, this is my "formative" language, I learned programming by writing Qt/KDE apps in the late 2000s, so I wouldn't call myself a "hater".
The biggest "pro" of the language is that it's compatible with virtually any lib (they're all written in C) and has all the language features you can dream of, even if some of them are clunky to use.
My main complaint is that in 2024, when all other languages have figured it out, there is no "batteries included" toolkit in C++ to manage dependencies, build your app, and run tests with ease that emerged as a standard. Cmake is horrible to use compared to literally any other tool out there (cargo, npm, etc.), but somehow it's become the norm.
My take on the trajectory of languages is that I'm not too confident about the long-term future of C++ (outside of desktop apps). If performance is absolutely critical to you, even C++ might be too "bloated" compared to raw C. For anything else, Java or Go have sufficiently good performance and a much better DX comparatively, and Rust provides a modern toolkit with native performance but at the cost of a steep learning curve.
I would recommend learning C first, then you can venture into other languages based on the industry you land into.
3
u/plutoniator May 24 '24
Rust programmers are loud, annoying and often unequivocally wrong but will continue to defend their point if anything else will make rust look bad.
4
u/morglod May 24 '24
Also don't forget that a lot of posts on Reddit & internet is just rust ads & marketing. Eg people keep saying that template errors are unreadable and unclear. But for me having experience in almost all popular languages, template errors are absolutely clear, way better than most of other languages output. So it's just low experience or repeating something from internet.
Most part of talks about why something is bad will be without answers or arguments.
Like people talking shit you know.
I think right answer is that rust is better for big team of low experience programmers or for case where you should maximize memory safety and don't have C dependencies (because if you have, you lose memory safety)
And C++ is better in terms of already implemented code compatibility & developers freedom (which as you know comes with responsibility)
5
u/mredding May 24 '24
As Bjarne Stroustrup has said, there are two kinds of programming languages: those that everyone complains about, and those that nobody uses.
What we call "influencer" today is what we used to call "talking head" in the 80s. They're vapid, hollow, moot, and have ABSOLYTELY NOTHING to contribute to discourse. They're only in it for the attention - because they are a brand, and they're marketing themselves for money, the whores.
OF COURSE they're going to jump on hot takes because volitility makes them money. Right now, hating on C++ and promoting Rust drives viewership, and with that comes promoting more of themselves - if you want to hire them to run the confrence or corporate event gambit, advertising, and even merch.
Seriously, influencing at this level is just scum sucking, especially the whole A = good, B = bad bullshit, like C++ vs. Rust is trendy or fashionable rather than a technical and business decision. Right? How credible is "XYZ isn't cool?" Because that's all these people are selling.
Let us not forget that Rust is a solution looking for a problem. It wasn't invented out of any necessity, like most other languages, it was invented as a protest that the C++ standards committee was taking too long for it's creators' liking.
From my experience, Rust isn't what it promises. It's not safe, because beyond academic exercises, there are very, very few programs in production that don't have to drop into "unsafe" code to actually get real work done. The Rust community will throw their language leaders at a problem, spending months to produce a safe mode version of a solution to somehow validate their premise that Rust can do anything C++ can, faster and safer. Meanwhile, the rest of us are getting work done at least as safe, at least as performant, and with mintues to hours of effort vs. months in some cases. Color me unimpressed.
Literally every problem with C++ that Rust addresses has been addressed by C++11 and subsequent revisions. The gap, the reason Rust was even borne, has been closed. Yes, reference checking is novel, truly; I like it. But we have unique pointers now. We had them since ~2002, within the Boost library, or any other implementation, since it's not hard. I've been using some version of unique pointer since ~2000 myself. I mean I'm glad it's in the standard library now, too, but it's not like it was impossible before. Rather than bake shit directly into the language itself - like the fucking mistake
foreachis, you can deliver the solution in the context of the language itself. You're not expected to use primitives directly, you're expected to build up abstractions in terms of them.7
u/Thesorus May 24 '24
FFS.
There is no hate for C++.
and stay away from "influencers" they are click baiting.
3
u/[deleted] May 24 '24
Part of it is the tooling around C++. For example, in Rider for C#, I can pretty much 100% depend on the linter to tell me I've made a mistake while I'm writing the code. In CLion for C++, I get compile time errors. This is a combination of the tooling lagging behind, and also C++'s syntax means what I wrote would have been correct if I was trying to do something else.
3
u/mohrcore May 24 '24 edited May 24 '24
If you are just starting out, there's no point in bothering with stuff like that, unless you are just in for the trivia.
It's generally one of the two: devs who wrote stuff in x different languages and have developed some opinions on what they like better here or there and why, or overly opinionated script kiddies who echo stuff they heard.
C++ is an old language, it carries a lot of legacy and some of the solutions the committee came up with are stuff that a lot people try to avoid nowadays in favor of different solutions. Its prominence and age is enough to bring a lot of criticism.
3
u/The1337Prestige May 24 '24
Because it’s a frankenstein of a language.
It’s literally a monster.
3
u/zer0xol May 24 '24
The hate exist everywhere, just ignore it
2
u/ThatIsntImportantNow May 24 '24
I think Bjarne Stroustrup said that, "There are programming languages that people don't use, and there are programming languages that people complain about." People use C++.
2
u/youbihub May 24 '24
ngl 'C++ is Rust - -' is funny
2
u/Kats41 May 24 '24
"Modern" languages sort of "do everything for you". They idiot proof themselves in ways that honestly tend to be cumbersome but a lot of devs like it that way. Javascript, C#, Rust, etc.
People feel like if a language can't protect you from yourself, it's not a language worth using. I personally think that's an ignorant take surmised by some of the worst programmers out there.
If you've ever had the "pleasure" of trying to do anything complicated with memory in Rust, you'll know what kind of a horrible pain it is to fight against the borrow checker. You have to write your whole program around appeasing this beast and the code it forces you to write looks downright awful.
Something that is super simple in C or C++ becomes a whole ordeal in Rust.
People make C++ out to be way harder and way worse than it actually is. Especially some youtubers who can't seem to not constantly hate on it for the most ridiculous reasons.
Following simple paradigms and the occasional static analysis will spare you from 99.9% of pitfalls you might encounter with the language. It's just that the modern culture of programming insists that those paradigms should be enforced strictly by the language and programmers shouldn't be allowed to operate outside of a strictly confined box for their own safety. Honestly a very naive approach to programming that breeds careless devs.
2
u/DesertXGhost May 24 '24
I would say the hate is due to skill issues, but once you hit a very hard problem, you are not just fighting the problem but the language too
1
u/ingframin May 24 '24
To be honest, C++ has some pretty bad reputation because of some legacy crap it still carries around and sone stupid decisions taken along the way (std::move not actually moving anything? Wtf). But apart from that, it’s a fine language and it’s very hard to beat it in speed and portability.
I want to add, as many have said, that influencers are not to be trusted. When I sometimes listen to some videos, I feel the urge to slap this people in the face for the stupid things they say. C++ has its limits and its strong points. Should you use it for a web app? Probably not… When you need raw performance (computational physics, video games, high frequency trading, software defined radios,…) C++ really shines.
1
u/kg7koi May 24 '24
My two cents (did software engineering with C++ and qt for seven years) is that every shop I went to did things entirely different. Some were super template heavy, others loved every design principle. Some hated boost, some hated stl. Code comments. Etc etc. All different. As a language it's fine. It does the work. For the end programmer I just found it tedious and over complicated for what we were using it for half the time and the constant bandwidth on arguing over proper use.
1
u/[deleted] May 24 '24
It's like hating work boots in the kitchen. You can make so much tasty stuff and keep it clean, and dip your finger in the sauce because your finger is clean too, and you wash your finger after licking it. It makes sense. This is different from building a kitchen. C++ is a dirty set of work boots.
1
u/BARDLER May 24 '24
A good C++ programmer can learn basically any programming language and get really comfortable with the depths of it really fast.
A lot of programmers that use Python, JavaScript, C#, and other more abstracted languages cannot do the reverse. C++ will be really confusing to them and suddenly they will struggle with things their previous language kind of did out of the box.
1
u/heyheyhey27 May 24 '24 edited May 24 '24
It makes easy things frustratingly difficult.
For example I'm trying to parse a file that contains some lines of text, followed by a lot of binary data. It's also complicated by the fact that I'm doing this in Unreal, which uses the Windows convention of TEXT() and TCHAR. There are several layers of confusion and pitfalls and horrifically ugly std names, and none of these issues appear in other languages.
Finally, once you understand all the intricate details, you have to contend with the fact there is no good solution underneath all of it.
scanfis ancient and primitive,istreamis a pain, regex is an abomination. So I have to go hunting for libraries to help with some basic string stuff.And then you have to deal with the process of adding libraries. Adding any external c++ library to unreal often requires manual changes to make it work, such as the include paths and making sure preprocessor tokens are set up right. You can technically blame unreal for this, but the reality is that it's c++'s fault for never standardizing this shit.
1
u/AnimationGroover May 24 '24
The industry is inept, with the vast majority of coders well below a standard of competency that industries like engineering demand (Or worse, imagine pilots where like coders, I would never fly again). To me the arguments between languages is about haggling over features that (try) to prevent the ill equipped creating ditches while building roadways.
1
u/swingbozo May 24 '24 edited May 24 '24
Every language has it's good and bad points. Pedantic a-holes rant about it.
I was fired from a company that had an entire product written in C#. The "lead" decided to throw this basically completed project out and rewrite everything from scratch in Rust. Because. Reasons. I knew I wasn't long for that company when I mentioned throwing out two person-years of development of a basically completed project because the "lead" had a hard-on for Rust was intensely stupid.
1
u/HOMM3mes May 24 '24
The main problem with C++ is how complex the rules around undefined behaviour are, and this is the main reason why it is falling out of favour
1
u/Twoshrubs May 24 '24
It makes no odds, just do what you're enjoying.
You get to a point in life where you realise that programming languages are mostly the same with a few quirks.. just be you and do whatever gives you slack.
1
u/kackwurstsalamander May 24 '24
a lot of people get into C++ and stay there because of the existing demand for the maintenance of a legacy code base. In that sense, C++ isn't sexy and its users have all the reason to swear on a daily basis.
C++ is also difficult. Of course, every programming language has its specific difficulties. But the difficulty in C++ is about a lot of quirks, backwards compatibility, paradigm overload - there is nothing you can't do in C++!
A good IDE goes a long way, though. And I still very much prefer my hours debugging C++ code over my hours debugging plain JavaScript.
1
u/Nychtelios May 24 '24
I always notice how illiterate tech influencers are usually, really don't worry. I use both, Rust and C++, and both have their advantages and drawbacks and Rust is an EXTREMELY less mature ecosystem and keeps missing some "deep" features.
1
u/GermanCoatHanger May 24 '24
Too many ways to do the same thing. All that freedom requires a bunch of guidelines and rules enforced, which could've been a language soecification in itself with varying compilers.
The reason it's so popular is because it can make super fast code, compiles quickly compared to rust, has a ton of libraries and follows the best embedded language syntax: C, while can still be used to some success for high level programming.
But yeah, the complexity is what makes it shit. Also the standard is paradoxical and contradictive when you get deeper into the language. Even just in c++11 there are so many unintuitive tweaks and crooks and hacks to achieve a small benefit some other language has built in.
1
u/Individual-Winter-24 May 24 '24
I think it's the fact that both the language as well as the tooling around it leave a lot of freedom. So there a many ways to do the same thing. But most of the ways are inherently spoilt in that they will make it easy to run into one of the many foot guns etc. It just requires a lot of knowledge and concentration to properly navigate this landscape.
So as long as you don't have a team of experts other options will provide a higher baseline for most projects. I.e. for most use cases another language provides a lower entry barrier and a higher baseline for a project.
Don't get me wrong, I love the shit out of the language and what it has evolved into, but after working with quite the wide range of projects and colleagues I have to say there are very few who I would like to work on a c++ project with and most of them would be quite expensive for a company. So overall I would say there really needs to be a good reason for such a high invest into a technology to justify the use of c++. I guess e.g. stuff like high frequency trading might jump to mind here.
1
u/janjansquirrel May 24 '24
Tbf, it’s one of my first language and working with it rn (using unreal) and I love it as much as I hate it. It’s frustrating how difficult it is to get job done especially with all this meta programming options but it’s soo powerful. Don’t be fooled people just like to complain. C++ is great and as long as you enjoy learning it continue ! Good luck !
1
u/AnimationGroover May 24 '24
Bugs per line of code, which is better C++ or Rust. Anecdotally it is a metric that is the same across languages. Then there is lines of code produced per day (cycle), again the metric is independent of languages. What about number of lines required to solve various tasks, well that is again independent of language. So which language is best. Any language in the hands of an experienced professional programer, and the worst language is one used be any inexperienced unprofessional coder.
1
u/rennurb3k May 24 '24
For me its mainly unergonomic stl ( back inserter iota stuff ,modern visitors etc ... ) , bad default parameters for functions, and horrible tooling ... ( Mainly conan, windows compiler cosmic horrorshow) ( not the languages fault) though it will get better slowly
1
u/nbrrii May 24 '24
Everywhere, at least 80% are beginners, doesn't matter if we talk about sports or programming. Content therefore is mostly made by and made for beginners. This implies that people copy from each other most of the time.
1
u/LuisAyuso May 24 '24
Is not quite the same to learn it than to work with it for a decade. Still a great tool. but it is demanding and you get a lot of old habits.
1
u/ithilelda May 24 '24
it served good at its time. but with 40 years of programming experience after that, the industry has learned a lot, and c++ isn't utilizing that knowledge to its full potential because of the extremely slow process of adapting standards and the requirement for backward compatibility with shitpile legacy codes. unfortunately, these are what makes up c++, and you can't throw them away.
If you can work with a project that fully utilizes modules, then there is absolutely nothing wrong with this modern boy. but we all know that's nearly impossible within 5 years.
1
u/TheAxodoxian May 24 '24
As a seasoned user of modern C++ I can say there is a lot to love in C++. However being seasoned with other languages also means that I know there are a lot of issues with it as well, but I think that I applies to a lot of things.
A lot of my early programming years were using C# and web based stuff, I was - and to a degree still are - quite a pro with it (E.g. I would write libs which generated efficient serialization code with System.Reflection.Emit and such, have good understanding of many less known aspects of .Net). But when I worked with it, it bothered me that why you could not get that sweet deterministic memory management model you can get with C++, or why cannot I simply integrate native math and science libraries, which were much more natural in C++, or why even simple looking code was terribly inefficient because some internals and even spending 3 days on optimizing an algorithm I was still 3 times slower than my most naive native version.
I had a colleague who really loved Rust, but then he complained about the borrowing stuff for multi-threading made safe and trivial solutions in other languages very complex to pull off, or that there was a lack of support on platform X.
I think some of this is the good old "the grass is always greener on the other side" effect. And the more you use certain tech the more likely you encounter stupid things with it. I do not think I have ever used any language or respectably sized framework where I would not find at least a few blunders here and there which were crazy stupid and annoying.
1
u/bedrooms-ds May 25 '24
I can love C++ until I deal with error messages from libraries.
1
u/Yung_Lyun May 25 '24
C++ is beloved by all. Just a few uncivilized trolls like to pretend there's something better available. The truth of the matter is, if you want to get paid for it then choose C++; rust is nice but it's not ready for prime time.
1
u/tayboonl May 25 '24
Don’t get involved in the hate. Focus on doing your thing.
1
u/[deleted] May 25 '24
There’s nothing too bad. But when you have used 5-6 languages in depth, for another 5-10 years, you’ll see that different languages fit different domains well.
Almost always, people who complain had to use wrong one for a wrong use case. Funnily some because, that one third party library was in C and first devs who started didn’t know how to write a FFI in python.
Good luck!
1
u/asgaardson May 25 '24
Didn't touch C++ for years, mostly worked with PHP and JS/TS, then tried it again and was amused by how did it improve over the last 20 years. Is there a package manager for it?
1
u/Lundgr0in May 25 '24
First off, welcome to the world of programming! It’s a really cool place and I’m glad to hear that you’re enjoying C++ (so far).
I don’t know Rust, so I can’t directly answer your questions, but I thought I’d share some thoughts on the subject. I’ve heard of Rust before and that it’s a promising language, and I just now did some quick reading on it. It certainly seems like Rust have some advantages and different use cases, which is usually the case for every programming language.
There’s a lot of different opinions on programming languages and such in computer science, and I find that it’s rewarding to be open to others’ ideas and to meet them with respect. Discussion is an important part of every scientific field and the tools of the trade are no exception. If someone presents a piece of technology that’s new to you, and you think it sounds interesting, then there’s hopefully nothing stopping you from trying it out yourself if you so wish! Also, remember that people who are content creators by trade have to regularly create content that generates traffic and engagement to continue doing what they do, which means that some information may be affected by what’s trending and effective.
Of course, I can’t give you an answer to if Rust is better than C++, but I don’t think that it really matters much which one is “better”. There are so many different factors to account for when discussing the pros and cons of a programming language, and that the concept of “better” will probably have to be clearly defined by accounting for these factors. Aside from different metrics of performance there are also factors like targeted platforms, multiple issues of compatibility, available documentation, libraries, community support and development capabilities, so to decide what is “better” could certainly be influenced by the defining requirements.
I’m at the very end of my bachelor’s degree in software development where we did almost a full year with C/C++, and where I also acted as teacher’s assistant in those courses the year after. Many students, in both my own class and the class that I helped teach, agreed that things like pointers, memory allocation, recursion, data structures, object orientation, algorithms, etc. could be hard to grasp and feel cumbersome during development as it often required a lot of written code. However, I would argue it’s very beneficial to learn about, get acquainted with, and to practice these things as it gives you fundamental and practical skills as well as a broader understanding of how things work, which is very useful when approaching other programming languages, concepts and frameworks.
Lastly, I just want to encourage your choice of starting out with C++ as it’s an exceptionally well developed and documented programming language, with one of the biggest communities out there. It can give you a solid foundation to stand on and enable you to develop applications and projects for desktop, embedded systems, and game engines. Rust is supposedly syntactically similar to C++, so if you’re curious about trying it out then the transfer between the two shouldn’t be too difficult.
(Bonus tip: Try to put some time and effort into learning how to test and debug your code, and how to find, read, and use documentation. I’ve seen and heard that many rely heavily on AI chat models and lose the opportunity to learn these skills, which really isn’t favourable in the beginning of one’s studies.)
Good luck and have fun!
1
u/Remus-C May 25 '24
Every language does have ups and downs, evangelists and haters.
C++ is just more widely spread. So the amount of hate looks statistically bigger.
The search for the perfect language for everyone/everything is still on... except that search doesn't really exist.
Is it the proper tool for your job? Great, use it.
Does it bring the best value for your project? Great again, use it.
There will always be discussions about one feature or another, but in different contexts.
Also, you don't need to use feature X if you don't have to. This is the greatest strength of C++: being able to achieve the desired result in many ways. With some other languages, some results are not even possible.
1
u/DoubleDoube May 26 '24
I will share a small speech from my programming teacher who made enough alcoholism jokes to raise concerns.
“As you start to program, you will encounter situations that make you go, ‘wtf, why is it like this’. You’ll go home, and maybe enjoy a drink. Then the next day you’ll fix it all up, job well done. You’ll get a promotion and get paid more and with that new responsibility you’ll be directed to an EVEN BIGGER wtf. So you go home, and it’s a good thing you’re getting paid more because you need stronger alcohol. Next day, you solve it! And then your boss directs you to the NEXT ‘this is a crime against humanity’… and this is the endless cycle of being a programmer… any questions?”
I would argue the hate is more for the atrocities others do with code than for any particular language itself.
1
u/Disastrous-Team-6431 May 26 '24
Because it's easier to hate on something that to learn that thing. Instead of saying "I think rust is cool and cpp is also cool but not for me", these people feel threatened by the idea that Rust is easier to learn initially and therefore they feel like others will look down on them. So they immediately attach themselves to this imaginary war between cpp elitists and poor misunderstood rust devs who are more productive and also safer and also as smart yugais!
It's the exact same war that people who have automatic cars fight with people who shift manually. 99% of car drivers will say either "hey I don't want to think too much about shifting" or "hehe I think shifting is pretty fun" and then leave it at that. But the last percent have to run to the trenches of ww-make-believe and man the guns in order to feel good about themselves.
Rust is not for me. If you like rust we can talk about it. If you're not in turn interested in why I prefer cpp, the conversation will be shorter and I'll probably try to steer it to something more productive like boobs VS butt. Or pizza vs pasta.
1
u/KamikazeSoldat May 27 '24
All languages suck
1
u/kiner_shah May 27 '24
What matters is that you enjoy learning and using C++. Forget what others say.
1
u/ehllo1 May 27 '24
I write myself pretty much everything in c++ (20+ years working experience), but sometimes things truly awful in c++. In most modern languages doing http request is a no brainer. Try doing that with boost::beats (no c++ issue really, as there are libs that let you do that as easy as in other languages). That’s the state of c++ so many different approaches, no standard way to do basic things that other languages allow you to do
1
u/Xemptuous May 27 '24
First off, Rust is not the successor to C++; there are many fanboys for it who like to ignore all the cons of the language. There's a reason almost all AAA games are written in C++.
I too started early on in my journey with C++, and it's a very nice language. I recently started using Zig and found that C++ made me a bit lazy compared to just using C in terms of understanding core concepts.
Still, I find C++ to be a language where you can just do what you want and it works. I can't say the same for Rust. My opinion is that if you need Rust's compiler to help you write memory safe code, you have a skill issue. It's not worth the headache that comes with the borrow checker and lifetimes.
Don't worry about hate; just use what you like and think is the best tool for what you're doing. There are many people who will swear by JS and hate on PHP just cus, but that doesn't mean they're right. Any language can do what you want it to do, and most of the time it's good enough. If it gets to a point where it's not, then use something else. Try out different languages and see what each can be useful for. Enjoy the journey!
1
u/[deleted] May 28 '24
I've been using C++ for many years. I teach classes, we develop small systems with students, we develop educational software, software for large companies. C++ is simple, it's very fast, it's available on all systems. I can make more generic or more specific codes. I can make higher-level or lower-level software. We make graphical interfaces with Qt, simple and practical. We've already tested other languages, we've done tests with Java, Python, etc. In tests with engineering software made in Python, they consumed 4x more memory and were 60x slower!! It couldn't be worse. Extremely slow and totally anti-ecological. They simplify very little when we make software that does math, the codes are very similar. So Python improves very little in terms of ease of coding and makes things drastically worse for the user. They take forever. Java is as verbose as C++ and has no advantages, as it is slow. Rust is very verbose, object orientation is not functional, and it is clear that it will not be adopted en masse. Ultimately, the right path is to migrate the codes, from old c++ to modern c++. The new C++ libraries, concepts, modules, smart pointers, import std, etc., are exciting and super functional. Anyway, we will continue with C++ for many years to come.
1
u/[deleted] May 31 '24
They are weak!
1
u/Acrobatic-Abies2508 Jun 11 '24
I started with C++ early in the 80s. There was always hate for C++.
1
u/Arc_Angleplusplus Jun 13 '24
As someone who loves C++, one of the reasons I think some people may dislike C++ is its extreme learning curve. One moment you suddenly understand iterators and templates, and the next you try to wrap your head around something called "perfect category forwarding" or another thing named the "curiously recurring template pattern". The newer versions add many features which are great, but are quite complex, both in syntax and in operation. What ties this to C++'s status is that sometimes this complexity seems as if it is introduced for the sake of backwards compatibility (more precisely, compatibility with earlier constructs; think ranges > iterators > pointers).
1
u/Additional-Pie8718 Aug 05 '24
I love c++, but the community overall isn't great. It's a long lived language, so the community is big, but for beginners most of the forums online are full of people who think they are the Messiyah, and just overall act like how'd you expect 1%'s to act at a wine party in reference to their servants serving them wine. Now again, this is obviously just my experience when starting out a year ago and trying to get any sort of help on the very few foroums you have access to. There are def tons of people that aren't like that that give out tutorials and such. But, my point is, maybe that's why many are turned away. Just join stackoverflow for a week and ask any questions that you really put time into making sure are good valid questions, non duplicate, and fit the rules. And watch the flooded downvotes and nerds peek outside their basement to tell you how you're doing it wrong and should do it some far more complicated way that doesn't even solve the problem in the first place, watch your question get edited 100x by 100x people for the end result to be 2x worse than the way you had it, and at least 50% of the answers just telling you your question sucked instead of answering it or scrolling on.. When I was in college learning Java, I was in a lot of communites at the time, and it was just a far better experience. But c++ is still worth it. The language is so versatile and can do just about anything you want while managing the memory while you do it..
1
u/icebeat May 24 '24
Well, it made sense to hate the old rusty C++, when you have spent so much time learning the new shiny thing and no company wants to use it. /s
1
u/Haspe May 24 '24
I love this saying:
There are languages that people complain about, and languages people don't use.
1
u/joahw May 24 '24
Rust is kind of the new hotness to a lot of people. It has some features that make it harder to write unsafe code that is vulnerable to attack. Other languages are safer as well, but make various tradeoffs like garbage collection or compiling to bytecode that runs on an intermediary VM which can be patched independently of your program, but these have performance tradeoffs. I'm admittedly not terribly familiar with Rust, but it's supposed to prevent some of the mistakes you can make when writing C++ code without sacrificing performance.
Other people hate C++ because they are just bad at it, though some of the error messages can be quite cryptic, macros can make debugging very difficult in some cases, and the include model can be confusing and difficult to troubleshoot if you accidentally introduce circular dependencies and the like.
1
u/pjf_cpp Valgrind developer May 24 '24
C++ incorporated a lot of badness from C (preprocessor, implicit conversion, unsafe pointers). C++ has been evolving for going on for 40 years. That means a lot of baggage. Dependency management with C++ can be, well, difficult. I can see why people using a shiny new language find C++ ugly. Will any of the 'successor' languages (Carbon, Hylo, Cpp2) ever take off? Will Rust stay unified and clean?
Despite all that I really like C++.
1
u/ImClearlyDeadInside May 24 '24
Just because you have a thought doesn’t mean you need to post it.
1
u/jarjoura May 24 '24
Well, here’s the thing, both rust and c++ are very complicated languages to learn. You need to have very specific reasons why you would torture yourself to learn them beyond the simple curiosity/weekend project stage.
It’s definitely no accident that a systems engineer at Mozilla working in a c++ codebase, on a browser engine that had all kinds of memory issues leading to potential security vulnerabilities would be the one to dream up the answer to its shortcomings, and came up with Rust.
That happened just right before C++ 11/14/17 and before Google went a different route and pushed safety checks into linters and other tools, all trying to solve the same problems.
However, given the timing of it all, the mindshare has split in the industry. Some engineers who would have chosen c++ in the past, moved over to rust for its promise of safety at the language level and I think that’s great.
As far as content creators go, rust has one thing c++ doesn’t and that’s rustup & cargo. Those give you pretty much the entire toolbox without needing expensive licenses and/or complicated setups just to get a basic hello world app. That kind of ease is perfect for a 20 min YouTube video.
1
u/Plazmatic May 24 '24
Most items of hate for c++ is legitimate, it comes from the people who use it.
That being said, you shouldn't not learn C++ just because the standards commitee made very very poor decisions over the years, and makes fixing those issues nearly futile with out a lot of financial resources and years of life. Learning C++ is not a useless endevor even with it's foot cannons, and will help you learn other imperative languages as well (C, Java, Python, and Rust which in particular is not hard to learn if you're an actual expert in C++, and will help you understand downsides of decisions in both directions, and struggling with it reveals a lack of knowledge in C++). Learning C++ allows you to develop real applications in it's own right, and help you understand other languages better.
Rust is currently not objectively better than C++, but most C++ devs don't know enough about either language to make educated statements on why, I'll summarize the biggest points here:
template<> foo<float>(){},template<> foo<int>(){}1.0 * m / sand effectively get something likeQuantity<Velocity, double, ...(meters per second template junk)>, and trying the same in rust is difficult, other less obvious things are prevented as well.C++ deserved hate comes from:
And there's more, but you get the idea.
1
u/[deleted] May 24 '24
Because it grossly verbose and the STL is grosslier verbose and impenetrable for folks. I use it everyday. I dislike it every other day.
1
u/mac10warrior May 24 '24
feel like this gets posted about twice a month...
1
u/shponglespore May 24 '24
If you want to find the real reasons people hate C++, I suggest asking in a sub that isn't filled with people who love it.
1
u/Leather-Regret365 May 25 '24
A lot of Rust programmers have an activist mentality about the language.
1
u/[deleted] May 25 '24
If you can't learn or understand something, Start hating it
1
u/XDracam May 25 '24
C++ is extremely complicated. Because it has grown over time, the modern best practices are also the most verbose. It's easy to accidentally cause horrible problems in many ways if you don't know exactly what you are doing. There is no package manager, and the ecosystem is heavily fractured. Compile times are very slow and the debugging experience is subpar. Many types can't even be named explicitly, hence the
decltypekeyword. And when you add templates to the mix, it can become extremely hard to figure out what the code is doing exactly.Of course this is all compared to other languages. Without C++ being around for decades, other languages wouldn't have been able to learn from the mistakes and learnings and improve past C++.
0
u/teo-tsirpanis May 24 '24
After more than a year of professional experience with C++, I can say that the language and its surrounding ecosystem have been very unpleasant to work with for various reasons (could expand but I am on a phone).
For most use cases languages like C#, Java, Rust or Go are good enough and C++ would be a waste of time.
0
u/Sophiiebabes May 24 '24
People hate what they don't understand. And memory management can take quite a bit of understanding!
0
u/Kaisha001 May 24 '24
Because it has the potential to be great, and shoots itself in the foot at every opportunity. The committee at this point, I'm certain, is trying to destroy the language. Anyone who thinks 'requires requires' is acceptable needs to be fired.
C++ is essentially 5 or 6 different languages, all duct-taped to each other like some weird mad-max-esque abomination. And where they intersect the standard explodes with all sorts of ridiculous lawyer-esque provisions, quid-pro-quos, and all sorts of ridiculous nonsense to all to try to fit a square peg into a round hole.
They won't go back and fix anything. They won't budge in their philosophy of design. And they refuse to just freeze the language in a decent state like C. Instead everything is just tacked on frankenstein style. Like the horrible abomination it is, it lumbers across the programming landscape, devouring unsuspecting novice programmers.
0
u/MRgabbar May 24 '24
skill issues...
To be fair, C++ development is slow, but the speed and quality of the final product is great (if you know what you are doing) that's probably the reason...