Live data from Hacker News

LearnCPP: Website devoted to teaching you how to program in C++

learncpp.com

71–80 of 145 posts

Re: LearnCPP: Website devoted to teaching you how to program in C++

#71
post #50

I wish there was a good place to learn “the other parts” of C++, the build systems, using static analyzers, testing, dependency management, etc. I’m thinking something like MIT’s “missing semester” course which teaches the boots on the ground part of software like how to use Git. https://missing.csail.mit.edu/ Maybe these resources exist for C++ and I just never found them. I think a lot of “modern” languages get thi…

> I think a lot of “modern” languages get this right by including these things from the start. The experience is so much better. I don't know how others did it, but I learned with MS Visual C++ in 1996. File -> New Project -> press F7 to compile, F5 to debug. That's it. ~30 years ago they got it right. I even remember my Windows CE experience ~15 years ago that allowed to build and debug the entire OS from an IDE. No…

I've always thought it was a little bit pathological that we require application developers to also be experts in build and deployment. The parts that can't be automated away should be handled by (highly paid) specialists so when your dev is deciding whether to make a change they don't have to factor in how it gets from their box to production.

Re: LearnCPP: Website devoted to teaching you how to program in C++

#72

Earlier quoted context omitted.

I feel the same way. I remember in one of my failed attempts to learn C++ I had been at it for a few weeks, and was excited to start my own little project in it. I needed to use a piece of software on GitHub and I just could not figure out how to get everything to build. It was a terrible experience that put me off the language.

Pulling in dependencies in C++ when you come from something like Python or Ruby is the absolute worst. I just recently fought through a big mess of this, the gist of it is ExternalProject[1] 1 https://cmake.org/cmake/help/latest/module/ExternalProject.h...

, which is in a state of active development and doesn't seem to have any good examples/tutorials.

Re: LearnCPP: Website devoted to teaching you how to program in C++

#73
post #50

I wish there was a good place to learn “the other parts” of C++, the build systems, using static analyzers, testing, dependency management, etc. I’m thinking something like MIT’s “missing semester” course which teaches the boots on the ground part of software like how to use Git. https://missing.csail.mit.edu/ Maybe these resources exist for C++ and I just never found them. I think a lot of “modern” languages get thi…

> I think a lot of “modern” languages get this right by including these things from the start. The experience is so much better. I don't know how others did it, but I learned with MS Visual C++ in 1996. File -> New Project -> press F7 to compile, F5 to debug. That's it. ~30 years ago they got it right. I even remember my Windows CE experience ~15 years ago that allowed to build and debug the entire OS from an IDE. No…

And then when something goes wrong, you’ll be staring at an opaque .vcproj file without any idea of what’s going on under the hood and how to fix it.

Re: LearnCPP: Website devoted to teaching you how to program in C++

#74

I wish there was a good place to learn “the other parts” of C++, the build systems, using static analyzers, testing, dependency management, etc. I’m thinking something like MIT’s “missing semester” course which teaches the boots on the ground part of software like how to use Git. https://missing.csail.mit.edu/ Maybe these resources exist for C++ and I just never found them. I think a lot of “modern” languages get thi…

Build systems and dependency management are not a part of the language, they're a part of the OS you're developing on (and sometimes for). Or maybe one of several alternatives available for that OS.

Re: LearnCPP: Website devoted to teaching you how to program in C++

#75
post #50

Earlier quoted context omitted.

> I think a lot of “modern” languages get this right by including these things from the start. The experience is so much better. I don't know how others did it, but I learned with MS Visual C++ in 1996. File -> New Project -> press F7 to compile, F5 to debug. That's it. ~30 years ago they got it right. I even remember my Windows CE experience ~15 years ago that allowed to build and debug the entire OS from an IDE. No…

And then when something goes wrong, you’ll be staring at an opaque .vcproj file without any idea of what’s going on under the hood and how to fix it.

For many kinds of projects, good luck doing it the makefile way (CMake, or whatever one fancies).

Yak shaving learning how to use all the compiler and linker flags, and library setup before writing any line of code.

Debugging vcproj files is as easy as going down the boilerplate generated by shell scripts and build generators.

Re: LearnCPP: Website devoted to teaching you how to program in C++

#77

I wish there was a good place to learn “the other parts” of C++, the build systems, using static analyzers, testing, dependency management, etc. I’m thinking something like MIT’s “missing semester” course which teaches the boots on the ground part of software like how to use Git. https://missing.csail.mit.edu/ Maybe these resources exist for C++ and I just never found them. I think a lot of “modern” languages get thi…

For the build system, I like: http://cliutils.gitlab.io/modern-cmake/ In addition to building, it will show how to add cppcheck and clang-tidy to your cmake files. That part is pretty easy. Just don't turn on every check in clang-tidy. Many of them are for specific code bases. Modernization checks are my favorite ones. Keeps you doing stuff the modern way. My link has you doing dependency management with git submodul…

It's been quite a few years since I've really written any C++ and I'm surprised the landscape hasn't evolved at all. People are making the same mistakes...

Modern CMake should be using toolchain files to specify the toolchain/flags. That should be included in ever CMake intro. (Hacking those into your CMakeLists.txt is not okay)

gitsubmodules are also a hack

1: Many dependencies are not setup to be used as a CMake subdirectory. Variables such as the project-version-number get overwritten by the parent project and more dangerously the submodule can start to change variables in the overall project.

2: Dependencies will often reuse target names. For instance, libraries often have a target called `uninstall`. Because redeclaring a target in a different subdirectory is a no-no - CMake crashes

Proper dependency management can be done directly through CMake without repeating yourself by using Hunter: https://hunter.readthedocs.io/

This solved the diamond problem, gives you proper namespaces in CMake and with Polly you can have sane toolchain files (https://github.com/ruslo/polly - but you can also just write them manually). Everything is built on CMake and Git (and git hashes). You get nice dependency build caches and forking dependencies is also trivial

EDIT: The creator of Hunter has his own CMake Intro. I haven't gone through it while-learning, but it looks comprehensive and informative: https://cgold.readthedocs.io/en/latest/

Re: LearnCPP: Website devoted to teaching you how to program in C++

#78
post #59
post #42

Earlier quoted context omitted.

Is it a bad idea to learn from Stroustrup's 'Principles'?

as someone that has done a lot of commercial C++ teaching in his time, i would say that this is one to avoid for a beginning programmer. stroustrup is not, imho, one of the worlds great teachers, and i would not recommend C++ as a first programming language. more experienced programmers should go with TC++PL.

Interesting. I'm sort-of experienced (never pro, but lots of little projects in JS & Python. I got Principles to try and fill in gaps in my basic knowledge & so far it seems like it has been helping. I'm a little over halfway through. What else would you reccommend?

Re: LearnCPP: Website devoted to teaching you how to program in C++

#80
post #75

Earlier quoted context omitted.

And then when something goes wrong, you’ll be staring at an opaque .vcproj file without any idea of what’s going on under the hood and how to fix it.

For many kinds of projects, good luck doing it the makefile way (CMake, or whatever one fancies). Yak shaving learning how to use all the compiler and linker flags, and library setup before writing any line of code. Debugging vcproj files is as easy as going down the boilerplate generated by shell scripts and build generators.

But at least I can see the commands being ran by `make` and work backwards from there. In VisualStudio you have to click around in a bunch of “Properties” menus (which may or may not have search boxes…) and eventually you may find what you’re looking for.
Post reply on HN