Earlier quoted context omitted.
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…
Tooling did help this situation somewhat, but it is not very discoverable. 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 wo…
LearnCPP: Website devoted to teaching you how to program in C++
131–140 of 145 posts
Re: LearnCPP: Website devoted to teaching you how to program in C++
#132Re: LearnCPP: Website devoted to teaching you how to program in C++
#133Earlier quoted context omitted.
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…
People grow by challenging themselves and this certainly applies to programming. One can’t use training wheels and expect to become skilled at system programming. I learned C++ as an absolute beginner in school back when most memory debugging tools didn’t even exist. Undefined behavior was just another bug that one learned to fix and most of the time it was nothing more exciting than a crash. Being disciplined avoide…
C++ is fun for sure, it was (and is) fun for me, but it's a very specific kind of fun.
Re: LearnCPP: Website devoted to teaching you how to program in C++
#134Earlier quoted context omitted.
Tooling did help this situation somewhat, but it is not very discoverable. 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 wo…
For sure, I'd also add -Werror to the mix.
Absolutely do use -Werror on CI, where nobody even looks at logs of a passing pipeline.
Without -Werror you can see all your warnings at once, for better or worse.
Re: LearnCPP: Website devoted to teaching you how to program in C++
#135As 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.
Most Rust stuff is just rewrites, crypto or some specific tool that some corporation or start-up needs. C++ is one of those languages that people write anything and everything in. Whatever you need, whatever you’re curious about, it’s likely out there. As for what it feels like, if you want safe but boring, go with Rust. If you want exciting go with C++. Personally I’d never start with Rust, it’s like biking everywhe…
Re: LearnCPP: Website devoted to teaching you how to program in C++
#136Earlier quoted context omitted.
I haven't done any C++ since 2015ish but your link seems incredibly outdated. Sure you'll learn some C++ syntax, but you'll learn the C++ from 20 years ago, not the modern C++ with smart pointers and all that stuff which is basically turning it into a new language.
Is it a bad idea to learn from Stroustrup's 'Principles'?
Re: LearnCPP: Website devoted to teaching you how to program in C++
#137Earlier quoted context omitted.
Git submodules are definitely a hack. My experience with conan has been unpleasant for several reasons, but mostly in regards to writing dependencies for code bases that use submodules and aren't interested in my team's suggestion they use conan. Vcpkg doesn't seem better, and probably a bit worse. Does hunter make this any easier?
I'm not super clear what your question is. If the dependency you want to use has no dependencies of its own - then it can be used directly with no changes (as long it's CMakeLists.txt is sane and it can use a passed-in toolchain file) https://hunter.readthedocs.io/en/latest/creating-new/create/... If the dependency has its own dependencies, then you need to "Hunterize" it - specify library versions, tweak the targets…
Re: LearnCPP: Website devoted to teaching you how to program in C++
#138Earlier quoted context omitted.
I'm not super clear what your question is. If the dependency you want to use has no dependencies of its own - then it can be used directly with no changes (as long it's CMakeLists.txt is sane and it can use a passed-in toolchain file) https://hunter.readthedocs.io/en/latest/creating-new/create/... If the dependency has its own dependencies, then you need to "Hunterize" it - specify library versions, tweak the targets…
Sorry I wasn't clear. I was responsible for the dependency that another team was using as a plugin. They weren't going to switch to conan, and our code was already using Conan for itself and its dependencies. They wanted to bring us in as a submodule, and that was just never going to work. I think what I'm pulling out of this thread is that c++ package management is so fragmented, there isn't really a safe choice to…
I don't see any reason that wouldn't work - but.. you'd have to test it. I've never tried running a Hunterless top-level project with a Hunter-ized subdirectory. The top level project would still get some benefits like the namespaced targets (so you won't clobber anything in top-level)
The only small catch is that Hunter inevitably does build a cache of build artifacts/targets for your dependencies. As long as you keep using the same toolchain files these keep getting reused each time you rebuild your project. That does however mean you will get some user folder like ~/.hunter with those build artifacts (look at the Hunter config options.. maybe this can be somehow hidden in the build directory?). I dunno if that would irritate the project users. If it's company internal that's probably an okay ask. If it's random devs on github then that's a bit not-nice :)
Re: LearnCPP: Website devoted to teaching you how to program in C++
#139Earlier quoted context omitted.
In a C++ course we teach at the Technical University of Munich (for students coming from a non-CS background), this is pretty much the direction we have recently steered the curriculum. It is amazing how we were always expected to "just figure out" all these very important practical aspects by ourselves as students, while these are so complicated for C++. In combination with a lot of outdated material out there, stud…
I always thought the pain was the point. They wanted you to struggle to figure it out, it’s how you learned how to learn. If everything is spoon-fed you end up unable to solve your problems when they arise. You expect someone else to have solved the problem and you start looking for them instead of attempting to solve it yourself. Kinda like the main plot point of Enders game.
One can say "but that's how I learned, and I am fine and shine today". This is probably true, but then I believe that such a person had the right background to anyway learn by themselves. I see our mission as teachers to help the students that actually need the help, rather than letting them give up too early, in favor of some kind of excellence evolution. And I believe that if we prepare the right groundwork (explaining all the ropes before we start pulling them), then even the more advanced students will be able to learn even more that they would by themselves in a more struggling environment.
Re: LearnCPP: Website devoted to teaching you how to program in C++
#140Earlier quoted context omitted.
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…
The reason I mentioned c# is because it feels like "if Java adopted new features at a decent rate" and these days pretty much all of it is MIT licensed. Coming from Java to c#, I found it much more ergonomic and productive mostly due to less boilerplate and more concise syntax sugar. There are several ways to compile it to native if you need to and it has great c/c++ ffi support, although if you're doing a lot with m…