HACKER Q&A
📣 sptth

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! ;)


  👤 kerneis Accepted Answer ✓
It won't help you learn C++ from scratch, but once you know a bit about it, the Abseil tips published by Google are a remarkably useful resource to learn best practices and modern C++: https://abseil.io/tips/

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.


👤 kbrtalan
Most importantly, code something in c++! Being "book-smart" with nothing to show for it is pretty much useless. A simple Snake or Tetris clone in SDL is a super rewarding first project, or you could give Advent of Code a go as it lets you solve a lot of cool puzzles that fit in a couple of hours at worst. As for books, I can recommend Effective Modern C++ by Scott Meyers. CppCast is a great podcast that can get you up to speed on the C++ ecosystem.

👤 IlGrigiore
CppCon, one of the major C++ conferences, has started some years ago a series of presentations, called "Back to basics", that are aimed at people that are just starting out with the language. Each presentation is thematic and can be watched independently from the others. The presentations can be found on the CppCon youtube channel:

- 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...


👤 aunyks
Can someone share how modern C/C++ build systems work?

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.


👤 Zolomon
Herr are some great resources:

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


👤 ameixaseca
I've been programming in C++ for the past 15+ years, from some toy UI applications to things like a fully-featured software DSP for a telecom gateway.

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.


👤 starwind
I am working my way through this https://www.freecodecamp.org/news/learn-c-with-free-31-hour-... and I enjoy it

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


👤 mtlmtlmtlmtl
I'm not a C++ dev, but I would recommend JetBrain's CLion IDE for C/C++ development. It has great integration with build tools, debugger, valgrind, iperf(for profiling). It's a bit pricy, but it's possible to redo the free trial indefinitely.

👤 bfrog
Which C++ do you want to learn? There’s a lot of history there. I’d look at various C++ libraries over the years written in the different dialects. C++ has so many variants it’s really hard to say it’s a single language as each one reads so differently. It’s like saying English is a single language without understanding there are wildly different dialects and meanings to the same thing.


👤 pavon
All of the resources I used to learn C++ are probably obsolete at this point, so I can't give any advice on how to get started, but I highly recommend reading Effective Modern C++ after you learn the basics, which covers a lot of best practices.

👤 speedgoose
If you don’t know already, learn how to use a debugger. Also valgrind is very helpful. And if it hasn’t changed in the last years, Clang usually provides more user friendly error messages compared to GCC.

👤 pdevr
Piggybacking on this: Is there any book out there which covers C++ 20? Most of the reference books suggested on forums (SO, IRC/Discord channels) seem to cover C++ 17 or 14, or even worse, 11.

👤 jsscss
I've been enjoying a series of youtube tutorials by someone called 'TheCherno' on my own C++ journey (although I'm still at the very beginning of it!).

👤 AnimalMuppet
I would start with "A Tour of C++", by Stroustrup.

👤 Shadonototra
flagged? rustaceans are a little rusty today

👤 quazar
There is no easy way. You must work through https://en.cppreference.com/w/