Ask HN: I whant to Learn C++ not Rust!!
I would like to learn C++ and I am looking for good learning resources (books, courses, tutorials, docs...). I would also like some introduction to modern libraries, compilers, latest standards, good practices...yes I know I want to learn everything. Well I am just asking here for good places to start my journey, also any advice other than "learn Rust"? I don't want to learn Rust (not for now at least)
Thanks in advance! ;)
39 comments
[ 2.2 ms ] story [ 84.6 ms ] threadIs there any edition that includes modern standards? (c++17 minimum)
It goes pretty fast if you've programmed before but covers a decent amount of the newer stuff. Once you get the fundamentals down you can probably figure out the C++20 features through the docs
In this case though, I can count how many jokes about “I’ve been writing C++ for 10 years when do I finally learn it”.
:')
They are one of the main tools used internally at Google to ensure engineers who have to use C++ stay on top of language evolution and avoid common pitfalls.
Thanks ;)
Part of the reason I’ve gravitated towards Rust as my system’s language is because every time I look at a large C++ project there are CMake / Automake / Make definitions that are really hard for me to read and understand. Some of them even seem to use symbols I can’t find in these tools’ manuals.
CMake/autotools syntax is nothing like C/C++, or actually any general purpose programming language, so you basically need to become familiar with this new language/paradigm in addition to knowing C/C++.
But like with most programming languages, once you grok it you will more easily learn other build systems. They all solve similar problems after all.
You just gotta pick one and learn it. I mean, you don't have to, you can write your own build scripts in bash or whatever but eventually you'll just end up inventing a new, probably crappy build system :)
> really hard for me to read and understand.
I agree and empathize. I tried figuring them out by looking at other people's Makefiles but they are all so wildly different between projects, it's like there is no standard/convention to writing them (and there is not as far as I can tell). Additionally, make has so much magic/internal/inferred/assumed behavior, variables etc. that it's really hard to figure out what they do by just reading them. Especially since they don't use familiar flow control structures like functions calls or even gotos. This also makes debugging hard.
I only learned make when I've started writing my own C/C++ projects. The documentation is actually quite good. Going from make to CMake was much easier then.
https://en.cppreference.com/w/
https://www.learncpp.com/
https://hackingcpp.com/
Books:
A tour of C++ 2nd Ed by Bjorne Stroustrup covers C++17 and a new version is in the works to cover C++20 and maybe 23.
https://nostarch.com/cppcrashcourse
- CppCon 2021, https://www.youtube.com/playlist?list=PLHTh1InhhwT4TJaHBVWzv...
- CppCon 2020, https://www.youtube.com/playlist?list=PLHTh1InhhwT5o3GwbFYy3...
- CppCon 2019, https://www.youtube.com/playlist?list=PLHTh1InhhwT4CTnVjJqnA...
I don't want to discourage you, and I think everything I did during this time was a good experience and taught me a lot. If you feel that's important for you, go ahead.
My point of view, which comes from my personal experience: even though Rust has some limitations, a number of areas for further development and a few rough edges for lower-level development, at this point in my career I don't want to touch C++ anymore unless I have no other choice.
Modern C++ is much better but it is not a paradigm shift (safe by default), the same way "labelled goto" (ie, C) is better than "numbered goto" (ie, BASIC) but it is still not a while/for.
You might reach a similar conclusion, or you might not. I just want to leave this here for you to reflect upon.
Regarding material, it all depends on the platform and what you would want to use C++ for. There are many references here already, so my advice goes to focus on C++ concepts and techniques and not too much on specific libraries - since they can be unavailable or impractical for certain environments/platforms.
What would you use now?