Live data from Hacker News

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

learncpp.com

21–30 of 145 posts

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

#23

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…

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++ actually is, especially the standard library. I understand how key the zero-cost tenet is in C++, but it's very alien to be picturing an interface and thinking you'd like an Iterable or IEnumerable there, but having to learn about iterators and traits and concepts etc. To be honest, there are equally many functional affordances in C++ as OO ones at this point, but the native core is generic programming, which is very idiosyncratic.

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

#24

The website sometimes fudges things with somewhat-incorrect statements. Maybe it's a minor issue, but I noticed that it says, for example: > When an initializer is provided after an equals sign, this is called copy > initialization. Copy initialization was inherited from the C language. > > int width = 5; // copy initialization of value 5 into variable width > That's not quite right. Consider the following program: #…

If you really want to embrace the horror:

https://www.youtube.com/watch?v=tH0Z2OvHAd8

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

#25

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 haven't used Java since school so I'm curious about modern Java. Do you need to worry about circular references preventing garbage collection or are there easy tools to detect such cases?

Circular references have never prevented garbage collection in any version of Java AFAIK.

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

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

Or in even more concise way here: https://learnxinyminutes.com/docs/c++/

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

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

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

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

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.
Post reply on HN