To me, it seems Rust is so much better than C/C++ in many ways: lots of Python-like abstractions, rigid compile time safety checks... A modern language designed from scratch without a hodge podge of welded on features.
Rust could also turn into something big, by the looks of it, in the next 10 years.
So I have two questions: how much does it make sense for me, in my circumstance, to learn Rust as my first systems language, and the second question is how much, in general ignoring my circumstances, does it make sense to learn Rust first?
I'm learning Rust now after several false starts. Here's what I find challenging and interesting about Rust: most languages exist on a spectrum between faithfulness and abstraction, where they either represent the underlying hardware in an accurate way (like C), or they provide high level abstractions that allow you to simplify your mental model of how a computer works (like python).
Rust is interesting in that it uses abstractions which don't lead to a simpler mental model. There's no such thing as 'lifetimes' from the computer's perspective. And yet these abstractions, though somewhat artificial, can still shape your code in beneficial ways.
I think that learning Rust without having exposure to C would make it difficult to recognize which constraints that Rust imposes are based on actual limitations of the machine vs Rust's particular paradigm. So I say learn them both.
Spend some time with C and learn the basics, do some experiments, and then learn Rust concurrently. It's not like you have to pick one or the other. You can be proficient with C while still becoming more fluent with Rust over time.
The short of it is, this is complicated, and it really depends on individual circumstance. You have given your circumstances, so I can help answer on that basis, but doesn't mean I agree it's the same for everyone.
There are two major ways of thinking here: Rust first, or C first. The advocates for Rust first will point to an easier onboarding story, a supportive community, a helpful compiler, and that you'll start off with good habits. The advocates for C first will point out that C is the latin of software development, and that you may not appreciate what Rust does for you without first experiencing the wild west of C.
Both of these have merits. I personally prefer Rust first. I of course, have a lot of bias.
I work in embedded Rust, and the thing is, the industry is still C based. Depending on which embedded devices, it may be your only option. So, I don't think there is any world in which you cannot learn C. Even though my codebases have no C in them at all, data sheets refer to C concepts, example code from vendors is all in C, blog posts and other helpful documents are generally in C.
So, absolutely, learn C to some degree.
Personally, what I would do in your situation is this: pick up a copy of K&R. Pick up a copy, either online for free, or in paper, "The Rust Programming Language." (I am a co-author. I don't make any money from the book; I recommend these two because they are generally considered the go-to book for each language.) Read them. See what speaks to you. Go from there. There is no reason you have to make a big choice up front and commit to it to all time. Try things. See what makes you go "I want to do more of that." And then move forward. Maybe you'll love C and never learn any more Rust. Maybe you'll like Rust and stick with it primarily. No way to tell until you give them both a shot.
(I actually strongly disagree with many of the ways that people characterize C, and even in this thread. C is not actually a small language, it is not super simple... but that doesn't mean it's not worth learning.)
Similarly, if you decide to go with C++ now, it's not a commitment if you later read about an awesome Rust DSP library or something.
It only becomes a commitment once you start writing real, production code in it.
It is also perfectly sensible to just set aside a week's spare time for each language and give them a try. You'll learn more real stuff from that than any amount of questions asked online about which is better.
I have only dabbled with Rust (I use C++ professionally), so I don't have a strong opinion about it. However, a lot of the positive reviews you hear about Rust are from amateurs who aren't using it in real products and a lot of the criticism you hear of C++ is from people who don't use it. Hopefully that helps you adjust some of what you hear to be a bit more grounded.
So, either choice is not wrong.
C and C++ are clearly different programming languages, so you are actually looking at three languages.
> Rust could also turn into something big, by the looks of it, in the next 10 years.
I wouldn't bet on that. 20 years ago, I heard Haskell and or Java is going to be huge. They are, C and C++ still are. Learn Rust by all means, probably you will be more quickly productive, and it gives you a wide range of choice of targets. That should be sufficient reasons to go that way.
> To me, it seems Rust is so much better than C/C++ in many ways: lots of Python-like abstractions, ...
Yes, but that is also an argument to go for either C or C++. You'll have to learn more. The active code-base in C and C++ is huge, and I don't see everything being rewritten in Go and Rust. Maybe you'll be less productive in churning out code, but it'll give you expertise to look and modify the existing code-base when necessary.
Not that you cannot do that when learning Rust.
In summary, I would go, with Rust, if you want to be quickly able to do your own stuff, C or C++ if you want to be able to work through existing code build "with a hodge podge of welded on features". The deciding factor between C and C++ again should be then, in what language is the code written you'll be looking at. I would say, (and others might disagree) kernel-code (OS kernel, that is), Microcontroller, low level stuff more likely C. C++ you'll find more likely in application code, numeric libraries, etc..
That said, the elephant in the room is the toolchain. With Rust you use cargo. With C you use ... a hodgepodge of technologies glued together with duct tape. While learning C, you'll also learn about make, cmake, autotools, ninja, bash scripting, etc.
C is easy. It's all that other crap that makes it more challenging.
I'd suggest learning C. It's the simplest language of the three, and it's the lingua franca of systems programming. You will have tons of resources and examples to work from. And you won't get stuck/frustrated over type system or lifetime issues. You'll always be making progress with C even if it's buggy.
While learning C, I highly recommend that you dabble in Rust. Rust has introduced important concepts to programming that will not go away, and just does a lot of things really well, including C integration. You also might appreciate the really easy cross compilation system for embedded development.
Especially if you're interested in embedded applications (and probably otherwise as well), I would suggest learning C to start with. Whether to go for Rust or C++ after that is up to you.
You should also include C in the mix (very different from C++(!!) that's why "C/C++" is a bit shunned upon by some people), because Rust or C++ are often overkill. If you're tackling Rust and C++ anyway (which is essentially a lifetime task), learning C on the side is literally a "weekend project" ;)
Just remember that C and C++ are not as similar as many people believe, they are different languages with different goals and a different philosophy.
If you have memory safety issues in Rust, it just won't compile (with extremely to-the-point compile errors). In C/C++, you might have to debug for a while (especially if you're new) as to why your app is inexplicably misbehaving.
Would you consider yourself an early adopter type who's more happy working on the bleeding edge? Rust is great but it's not a mainstream language yet and working with late adopters will be difficult. There are fewer project and job opportunities in Rust. You may have to be comfortable with writing your own libraries and tooling.
If you're more of a late-adopter type you probably value stability and maturity of the tools you rely on and perhaps put more emphasis on solving your domain problems rather than language tooling and tech problems.
The other factor to consider is what your goals are. If the incumbents in telecommunications have built a large ecosystem of libraries and tooling in C/C++ you're going to be working in a small niche writing things in Rust. Do you want to carve your own ecosystem in the space or would you rather spend time improving the status quo and moving ahead with the rest of the pack?
There are no wrong answers! It all depends on what you value more. They're all fine languages and tools. If you lean towards Rust simply because you're happier working in it then go for it. If you're not being paid to work on these projects then happiness is definitely a strong indicator you should be using Rust.
Happy hacking!
I feel like I'd prefer Rust, due to being simpler and more straightforward. It doesn't have decades of history, so there's less of a situation of having a bunch of legacy ways to do things with various footguns. Cargo makes it easy to pull in crates and build things with them. Some of it's parts, like Serde, are really slick. Others, like async support, are still a little tricky.
On the other hand, there's no denying that C++ has a massive library of integrations with all sorts of things, and supports way more hardware, due to it's immensely long history. It's the preferred way to interact with most of the native GUI libraries out there. There's a zillion libraries you can connect to your C++ code. It's probably a little more complex than the best Rust integrations, but better a well-tested natively supported integration than trying to build a new Rust integration around it, or rely on a half-finished open-source project that nobody cares enough about to support.
If any of those C++ reasons sound like something important to you or that you might want to work with in the future, then go with C++.
But HN is its own echo chamber. Rust is practically unheard of outside the enclave. If you learn Rust, you will be obliged, in short order, to learn other languages that are actually useful in your target area.
So, find out what languages are used there, and learn those. The only bad mistake would be to start with C.
That said, it is not a mistake to learn Rust. Just don't expect it to be usable at work.
What you want to learn (especially in embedded world) is how various Linux/POSIX APIs work, not language features.
So either choice is good as long as you learn to use them, but I personally recommend C because C is the first class language for Linux APIs e.g. they are exposed directly via #include As others recommend, you can learn C and Rust at the same time though.
Even if you don't wind up doing embedded work, you can cffi your python to Rust libraries for performance optimizations. You probably won't be writing optimized Rust for a while, so don't plan for quick wins with Rust extensions until you're several months into working with Rust full time.
Rust is something you learn if you want to get a job doing Rust or for your general knowledge, not if you want to solve a problem or understand an existing domain.
Learning just C/C++ is also completely fine, so don't think it is a waste of time or anything like that, both are not going to go anywhere and having them on your toolbelt will help even if you do decide to go with Rust in the future.
It's just a lot harder to write broken programs because of how screamy the compiler is in Rust. You will spend more time getting your code to compile but it will have fewer errors (and be multi-threaded+memory safe by default).
I think most production software that is written de novo today will be in Rust over C/C++. It's just not comparable in my opinion. Like, when we implement stuff we can have logic errors but eliminating the entire class of buffer/array/pointer failures is extremely useful.
Also, if you have a chip that you think you might be working on, check out the development tools from the chip manufacturer, it will probably be made for C.
Learning to use a chip is much easier if you have a library of examples written by the chip-maker for that specific chip.
For those reasons I would recomend C.
Also, for number crunching- since you're a data scientist– Julia and Numba might be better choices, as they crunch numbers efficiently.
You can do the same thing in Rust, but it's a bit more work.
Structure and Interpretation of Computer Programs is still the best single book on computer programming: the most important concepts (closures, continuations, macros, transformations,...) for the least expense in complexity.
To what you learn from SICP, rust and C++, add just one thing: how to exploit a physical stack efficiently. Scheme->C++/rust will be easy. C++/rust->Scheme can still be quite difficult depending on how distracted you got by the complexity.
As a practical matter, most system software is written in C. Being able to read the Unix kernel has been valuable for nearly 40 years. You'd be surprised what one can accomplish with just functional decomposition.
You should really start with C as it gives you a solid foundation both of how things work under the hood, and you'll be likely to have to dive into C from time to time. Apart from K&R, Hacking: The art of Exploitation 2e[0] is a really great book to grok C.
But you can safely skip C++. Rust is a C++ killer IMO.
[0]: https://en.wikipedia.org/wiki/Hacking:_The_Art_of_Exploitati...