Ask HN: Best way to learn modern C++?
686 pointsDo you have some good advice or know any useful resources to learn in a proper way how to code in C++? For the context, I know some C, but C++ seems a different kind of beast, and it's easy to get lost in the huge variety of features and libraries it offers.
Comments (173) 47 threads
Show all comments
Showing thread 45 of 47
You should check out Rust, it aims to replace C++ and do a better job in memory management, and developer experience in general (cross-platform compatibility, package management, etc)
No one can replace it, but everyone has to try.
Continue this thread — 8 replies
Ada also had a shot, I think, but they screwed it up with no C compatibility and expensive SDKs - or something. For some reason, Ada is just not perceived as "cool". It actually seems like a pretty good language!
Continue this thread — 7 replies
SIMD, GPGPU, GUI, embedded platforms, iOS, Android, UWP, COM, certified compilers, ...
For example,
https://www.iar.com/iar-embedded-workbench/certified-tools-f...
Continue this thread — 2 replies
Most compilers do a reasonable job with auto-vectorization, and if more is needed, there are instrisics.
No need to write straight Assembly.
Are the intrinsics standard? If so, what version of the standard were they in? How good is compiler support for them?
Continue this thread — 1 reply
Regardless, yes, that’s the whole point. What’s been accepted is https://doc.rust-lang.org/nightly/core/arch/index.html , that is, intrinsics that map 1-1 to the vendor APIs. (I belive this is the same in C++ but not my area of specialty so I may be wrong)
https://doc.rust-lang.org/nightly/core/simd/index.html is the first level up the abstraction chain; this hasn’t gone through an RFC process yet, but will eventually happen.
On top of that, you have stuff like https://crates.io/crates/faster , which is very high level. Looks like they need to fix up the README... but you get the idea.
Also, autovectorization has existed this entire time. This stuff is for when that falls down.
To comment briefly on the learning curve, the trade off is basically, C++ is easier to get started, but harder on the high end. Rust is a bit harder for C people to get started, but then the high end is much easier. Rust’s curve is flatter, in a sense.
Oh and also: learning one will certainly help you learn the other in many cases. I advocate learning many languages :)
This week I’m visiting a ~700 person company in London that’s moving away from C and towards Rust. They’re not doing a Big Rewrite, obviously, so they still have quite a bit of C too. They chose Rust over C++ though. It always depends!
Especially the Rust borrow checker will make you mad in the first place, and then teach you something about memory management you will be able to use in C++. It really improves your mental model in places you didn't expect.
Continue this thread — 3 replies
Continue this thread — 1 reply