Live data from Hacker News

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

learncpp.com

41–50 of 145 posts

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

#41
At one point in time I thought C++ was too complicated since I was only familiar with Java, Javascript, Python. I feel I didn't understand the reason for the complexity.

Then I began to study algorithms and then code generation at the assembly level. I've written very little assembly. But I want to generate assembly. This puts me in a difficult position.

Today I think C++ is fascinating as a language because it has wide implementer support (cppfront, MSVC, GCC, clang) and it is well defined as a language.

Someone can read the C++ standard documentation and implement a compiler for generating assembly for that AST. That's fascinating. Especially for a language as advanced as C++.

I am also fascinated by metaprogramming and C++ templates. I needed to learn how to use C++ templates to use coroutines with threadpools in C++. Can't say I understand them completely but I understand how we need to provide specializations to the compiler so it knows how to generate code for different cases.

I feel there's a missing orthogonal specification of computation that is cleanly compilable. As with Rust, with C++ there is many programs that are wrong by arrangement of tokens. It would be better if most arrangement of tokens are valid programs, due to semantics of the language not being subtle.

https://stackoverflow.com/questions/74520133/how-can-i-pass-...

I feel there's an omitted abstractions when it comes to code generation. The languages we use to represent computation in and relationships between things are rather low level. Mutable state is very difficult to reason about.

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

#42
post #21

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

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

#43

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

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

#44
post #32

I loved the uni course that I did many many moons ago, and hey it's online and is complete enough that anyone can work against it: https://www.dcs.bbk.ac.uk/~roger/cpp/

The problem with it being many many moons ago is that C++ has evolved so much since then that that course is now so outdated it's pretty much irrelevant.

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

#45

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

As a C++-head with little experience in Python - I would ask you to elaborate a little. What were trying to achieve with Numba, that gave you headaches?

Symbolic regression which involves a ton of CPU-intensive mathematical operations, but Numba is very picky on what it will or won't optimize.

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

#46

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…

This is a good idea. Most modern languages have their own build tool which handle most of these things, so this requires some separate learning with C++.

Some ideas for a curriculum:

Context

- C++ as a standard, compilers as implementations

- a build tool's role in handling compilation and linking

- compilers having limited abilities, having limited warnings and analysis by default

Build tools

- evolution: e.g. make -> autotools, cmake, meson

- focus on meson as the build tool of choice (personally I'd avoid CMake since it has a lot of legacy baggage)

Testing

- gtest/gmock

- catch

- designing for testing

Analysis tools

- why you should care: security, catching bugs

- cranking up built-in compiler warnings to reasonable standards

- external tools like clang-tidy, cppcheck

- sanitizers: address sanitizer, leak, thread, etc.

- fuzzing

Dependency management (probably the toughest, since it's still a mess)

- history: usually just relying on system packages, or installing libraries globally from source

- Conan (probably the best option for simple dependencies that's actually catching on)

- CMake external projects, Git submodules

- Docker

- Nix (if you're feeling adventurous)

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

#47
post #40

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

I'm just a little further down the road than you are and the best course seems to be to learn a little C++ first because it will help inform why Rust works as it does. Then when you try Rust, if you hate it, you've still got C++.

We'll be waiting for you on the Zig side :>

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

#48

As a Java dev who learned C++ at university the hate towards C++ is misplaced. C++ is a no thrills language which lets you have freedom but freedom to also shoot yourself in the foot 100+n ways, but this gives you a good foundation as a developer IMHO. Every time I think about garbage collection in Java, I can appreciate that I am not having to write code to destruct an object or worry about passing references incorr…

I switched from C++ to Java too. Still, every time I type `new MyObject()` without a corresponding `delete` I feel like I got away with some sort of crime ;)

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

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

Now you have to open your command line and write like it's 1985.

Today VS is free (Visual Studio Express?), with analyzers, tests, vcpkg, etc. There is also Qt and other similar tools that I use for embedded like Keil, IAR, Eclipse derivates, etc.

C++ != Makefiles. I don't write Makefiles or fiddle with the build system since... ever?. Except for some AOSP stuff that still uses them or perhaps editing some linker script for embedded.

PS: that said, "experience" is relative. Having to use the command line in general but mostly for learning is terrible.

Post reply on HN