This tutorial does not include modules, the best feature in C++ in a while. Is there a modern c++ intro or tutorial that includes CMake, modules, concepts, etc?
LearnCPP: Website devoted to teaching you how to program in C++
121–130 of 145 posts
Re: LearnCPP: Website devoted to teaching you how to program in C++
#122Earlier quoted context omitted.
If you're really new, I'd say either python or c# (unless you have a goal in mind). C++ and rust are both a lot more difficult to learn if you don't have any background imo. The scoping and memory management rules will distract you from learning the basics. Something like python with jupyter notebooks is pretty much perfect for learning or putting together quick projects, and c# to me feels like a more forgiving c++…
I'm already fairly deep into python, kinda knowledgeable in JS to make some minor stuff and currently I'm practicing a lot with git. After than it comes Java (i'm following a self-paced bootcamp path). Java seems interesting from an employment perspective, but the small stuff I've touched seems extremely verbose. I feel like I have to write and think way more to do simple stuff. But I just had a brief introduction, I…
I'd suggest waiting until you learn some java/c# before starting on c/c++, or instead starting at old school c (k&r c) or arduino c++. Modern c++ is a beast to learn.
Re: LearnCPP: Website devoted to teaching you how to program in C++
#123Is this website any good? It's heavily pushed by some C++ subreddits. I don't even know what I would recommend to a newbie. I learned C 25 years ago, and dabbled in C++ 2 or 3 times since then. Bjarne's books might be great, but they aren't for anyone new to C++ and especially not anyone new to programming in general. C++ For Dummies/21 Days style books are just bad. And there are more bad websites than I can count.
Re: LearnCPP: Website devoted to teaching you how to program in C++
#124This tutorial does not include modules, the best feature in C++ in a while. Is there a modern c++ intro or tutorial that includes CMake, modules, concepts, etc?
Are modules production ready yet on all platforms?
Re: LearnCPP: Website devoted to teaching you how to program in C++
#125If you already know a programming language and prefer a more concise tutorial you might also like this site: https://cplusplus.com/doc/tutorial/ It's way less verbose and more to the point.
You should absolutely not use or recommend that site. It's stuck on incomplete C++14 at best and also contains some pretty bad code. learncpp.com is a much better tutorial and cppreference.com is a much better reference. The only thing cplusplus.com is good at is polluting search results.
Re: LearnCPP: Website devoted to teaching you how to program in C++
#126If you already know a programming language and prefer a more concise tutorial you might also like this site: https://cplusplus.com/doc/tutorial/ It's way less verbose and more to the point.
You should absolutely not use or recommend that site. It's stuck on incomplete C++14 at best and also contains some pretty bad code. learncpp.com is a much better tutorial and cppreference.com is a much better reference. The only thing cplusplus.com is good at is polluting search results.
Just as an example, cppreference doesn't have a page dedicated to std::string (when you search for it on Google, it tkes you to std::basic_string) whereas cplusplus does.
Even comparing the two pages, cplusplus immediately gets to the point that std::string is just a std::basic_string, whereas cppreference has three paragraphs of technical minutiae before it finally points out what std::string is.
Even though cplusplus is out of date and incomplete, it's still often more useful than cppreference when you're trying to get your head around STL for the first time.
Re: LearnCPP: Website devoted to teaching you how to program in C++
#127Earlier quoted context omitted.
I've been getting back into C++ after an extremely long hiatus and I've been impressed by how thoroughly modern it is. The worst crime you're likely to commit these days is accidentally invoking a copy constructor more often than you want to, and even then, not actually creating leaks. In fact, the most striking thing coming from a language like Java or C# isn't memory management at all, is how utterly non-OO C++ act…
Even when C++ was created, object-orientation was not a goal, but rather a means to an end. Yes, that was a significant feature, and the original name was "C with objects", but even then it was only part of the bigger picture, and that part got smaller over time. The next big step away from an OO-orientation of the language (no, that's not a typo) was when the STL was adopted into the standard library - with its iter…
Re: LearnCPP: Website devoted to teaching you how to program in C++
#128Earlier quoted context omitted.
For Java'eans, here's an interesting StackOverflow question about why there's no Garbage Collector in C++ and what it means: https://stackoverflow.com/q/147130/1593077 and my particular answer: https://stackoverflow.com/a/48046118/1593077 in essence, with Modern C++, it is relatively easy to just not produce garbage which needs to be collected :-)
I've been getting back into C++ after an extremely long hiatus and I've been impressed by how thoroughly modern it is. The worst crime you're likely to commit these days is accidentally invoking a copy constructor more often than you want to, and even then, not actually creating leaks. In fact, the most striking thing coming from a language like Java or C# isn't memory management at all, is how utterly non-OO C++ act…
As much as I like modern C++, use after free is still way too easy to commit. But if you stick to value types and mostly don't store references/non-owning raw pointers, then it's OK.
Re: LearnCPP: Website devoted to teaching you how to program in C++
#129After many headaches trying to get Numba to work with Python, I decided to just go out and learn C++. This was my main resource and can highly recommend.
Re: LearnCPP: Website devoted to teaching you how to program in C++
#130As a newbie into programming, I get pulled all the time by people to learn my first compiled language either in C++ or Rust. Every time I ask even the most innocent question in any forum it becomes a shitshow, and I can see, I'm late to the party here in HN.
Please do not start with either C++ or C. They are horrible, horrible languages to learn as a beginner. Not because of bad tooling, incompatible compilers, tons of features, or even manual memory management and pointers, no. Two words: undefined behavior. In other languages, if you do a mistake, something fails around the place where you did it, or at least afterwards, or at least you can reason why the failure is ex…
If a beginner started off with a clang or gcc toolchain, then I would immediately suggest the following command line options for the compiler (the exact standard version does not matter, just stick to one):
-std=c++20 -pedantic-errors -Wall -Wextra -fsanitize=address,undefined
And there are a few toolchain specific macros worth adding.This would help with most undefined behaviors encountered as a beginner, although the sanitizers don't catch everything.