Ideally, one would learn Rust and C++ both and see how they differ, and why.
It's not going to be a particularly interesting thread if everyone who works in a language that trends higher than Go on Google chimes in to say "you should learn my language instead, because it's more popular".
> Ideally, one would learn Rust and C++ both and see how they differ, and why.
Aside from uninteresting language-specific details, C++ essentially doesn't teach you anything that Rust doesn't.
I think C++ is unique in that it is really not as popular as many new languages, not as trendy and as much in the news, and not even taught as much in college programs, yet, it remains the language where so many jobs are. This gives anyone with the desire to learn it a good and marketable skill that can make it possibly easier to find work and continue making a living doing software development. That does not apply to Rust, so I think it's a fair point to make to anyone who is asking about what languages are good to learn.
As for whether C++ has any techniques to teach that Rust does not, C++ is definitely a unique experience to go through and certainly gives a developer more insight into the actual machine they are working on in a way that few languages do.
"The" language where so many jobs are? It's one of many.
> As for whether C++ has any techniques to teach that Rust does not, C++ is definitely a unique experience to go through and certainly gives a developer more insight into the actual machine they are working on in a way that few languages do.
Can you name, specifically, a way in which C++ gives you "more insight into the actual machine" compared to Rust?
And, perhaps most significantly, there are a wealth of C++ libraries out there that have no equivalent in other languages, and being able to use them is an education in itself.
If you want to understand what is actually happening on the machine, I do not think it is the best choice. C would be much better.
So, learning to code professional C++ will not help you understand machines more. You'd have to learn C, basic OS/CPU structures, and which compilers produce for certain C statements. Maybe read Write Great Code by Hyde or some online articles. Learn C++ to understand machines? Not happening unless you microprogram a CPU for it on a FPGA.
Given that you didn't answer the question, I think it's pretty clear at this point that you haven't used Rust. Rust is a low-level language with low-level control over memory and resources.
Variadic generics and template templates are hardly interesting compared to concepts, pattern matching, and lifetimes. I use those every day in Rust, they simply don't exist in C++, and with the exception of lifetimes plenty of other languages have them too, so they're broadly useful to know. Variadic generics and template templates, on the other hand, are useful for a small subset of advanced library authors who have been programming in C++ for years.
The original assertion was:
> ...gives a developer more insight into the actual machine...
For better or worse, Rust feels like a reference is a proper abstraction over a memory location whereas C drives home that it really is just a number. Perhaps I don't know Rust well enough but, without unsafe, I'm not sure how I would refer to an arbitrary memory location or use pointer arithmetic to access memory locations relative to a known memory location in Rust. Vector indexes in Rust appear to be more than just syntax sugar for addition whereas C allows both array[2] and 2[array]. And I know that Rust will prevent me from accessing memory that's already been freed since it's one of the selling points of the language.
Now you can argue that Rust is mostly saving you from unpleasant consequences, and you'd be right. But the fact that C forces you to understand those unpleasant consequences teaches you something about the nature of the underlying machine. C makes you realize just how much of a "wild west" situation exists at that level. It would be very easy for someone to learn Rust without being confronted with that fact.
So, anyone following your argument should skip C++ and learn COBOL because COBOL is easier to learn, in widespread use, and has jobs available.
>In 2006 and 2012, Computerworld surveys found that over 60% of organizations used COBOL (more than C++ and Visual Basic .NET) and that for half of those, COBOL was used for the majority of their internal software. 36% of managers said they planned to migrate from COBOL, and 25% said they would like to if it was cheaper. Instead, some businesses have migrated their systems from expensive mainframes to cheaper, more modern systems, while maintaining their COBOL programs.
Main vendor even has it on Visual Studio: http://www.microfocus.com/solutions/cobol/index.aspx
The job is boring, predictable, and 9-5-ish at most places. Exactly what some types of people are looking for. They figure they can play with the fun stuff at home. One person even jokingly made a web framework for it: COBOL on Cogs. So, yeah, I throw COBOL at anyone using the "use language X for users or jobs" argument to see how they react to what they're actually arguing.
Interesting that you at least looked it up and didn't go into denial mode. I'm impressed. ;)
This is exactly right, and it's been true for many years now. That your old codebase is written in C++ is a totally legitimate reason to use C++.
But really, what's the point? The reasons you'd learn a low-level systems language are to learn how to manage memory and resources, to learn how to explicitly lay out data and to understand how to program without a runtime. Both Rust and C++ will teach you these.