Two words: undefined behavior. In other languages, if you do a mistake, something fails around the place where you did it, or at least afterwards, or at least you can reason why the failure is exactly where it is. In C++, you cannot. Accidental array bounds overflow? Too bad, now your program crashes in a completely unrelated closing bracket (not even a statement) five minutes later.
In other languages, if your program does not crash and produces a correct answer until point X, you can be more or less sure that everything afterwards at least gets corrects inputs. Not in C or C++: if there was an UB before point X, the program may look like it does random things: some stuff is printing, some stuff is shown in the debugger, random lines are executed, arithmetic operations make no sense, perfectly valid functions crash: https://stackoverflow.com/questions/54120862/does-the-c-stan...
I learned C++ as an absolute beginner in school back when most memory debugging tools didn’t even exist. Undefined behavior was just another bug that one learned to fix and most of the time it was nothing more exciting than a crash. Being disciplined avoided the problem in the first place…
People really have a tendency to dramatize C++. Yes, memory errors are a significant problem for people writing operating systems or browsers that get attacked all the time. For a beginner C++ can be much more fun and instructive than any so-called safe alternative.
C++ is fun for sure, it was (and is) fun for me, but it's a very specific kind of fun.
If a beginner started off with a clang or gcc toolchain, then I would immediately suggest the following command line options for the compiler (the exact standard version does not matter, just stick to one):
-std=c++20 -pedantic-errors -Wall -Wextra -fsanitize=address,undefined
And there are a few toolchain specific macros worth adding.This would help with most undefined behaviors encountered as a beginner, although the sanitizers don't catch everything.
Absolutely do use -Werror on CI, where nobody even looks at logs of a passing pipeline.
Without -Werror you can see all your warnings at once, for better or worse.
Plus rusts strict memory management rules don't really translate to other languages, and c++ has a habit of changing wildly. The c++ of 10 years ago barely looks the same whereas python and c# feel less like the goalposts are moving.
Java seems interesting from an employment perspective, but the small stuff I've touched seems extremely verbose. I feel like I have to write and think way more to do simple stuff. But I just had a brief introduction, I guess I can get used to it.
I wanted a compiled language that allows me to tackle some interests I have, and I feel It will be c/c++ wether I like or not, because one of my interests is fiddling with hardware. Nim can compile down do C apparently but it isn't widely adopted.
I'd suggest waiting until you learn some java/c# before starting on c/c++, or instead starting at old school c (k&r c) or arduino c++. Modern c++ is a beast to learn.
C++ is one of those languages that people write anything and everything in. Whatever you need, whatever you’re curious about, it’s likely out there.
As for what it feels like, if you want safe but boring, go with Rust. If you want exciting go with C++.
Personally I’d never start with Rust, it’s like biking everywhere with training wheels.
Rust will beat you over the head with a way of thinking that carries nicely back to C++, and the tooling (Cargo, etc) is more comparable to what someone coming from another language ecosystem would know. Smaller things like Rust's decent support for functional programming seems to click with everyone I know who's dabbling from the JS world.
For those reasons I'm very excited about Austral. The borrows, linear types, and the notion that anything that isn't explicit is wrong, all appeal to me.