
Master C++ Programming with Open-Source Books - vinny12
https://www.ossblog.org/master-c-programming-with-open-source-books/
======
saurabhjha
I have some C programming experience and I wanted to learn C++ so I bought and
started reading Stoustrop's book, thinking it's the K&R of C++.

It's the worst programming book I have ever read! It's introduction made me
hate C++ and if I didn't had to work with other C++ libraries, I would have
avoided C++. The text is full of bloat, for the lack of better word. It's the
opposite of crisp writing.

I read some good language books like K&R's C, Joe Armstrong's Erlang book. I
loved them and I thought this would be in same league. It's not.

I would like to learn C++ systematically, like not cut-and-paste stuff. "How
to think like a computer scientist: C++" seems like a good book. I read the
book "How to think like a computer scientist", which is an introduction to
programming in Python. I think that would be a good start. Is it a good book
for experienced programmers wanting to learn C++?

To people wanting to learn C++, please avoid Stoustrop's book like Plague.

EDIT: I read "The C++ programming language 4th edition" which explains C++11
[https://en.wikipedia.org/wiki/The_C%2B%2B_Programming_Langua...](https://en.wikipedia.org/wiki/The_C%2B%2B_Programming_Language)

~~~
muyuu
>thinking it's the K&R of C++.

You nailed it with that analogy though.

K&R is a "first book" and important historically, but right now it's an
atrocious book if you want to learn current C and this has been the case for a
long, long time.

Sometimes these first books don't withstand the test of time.

~~~
jdhopeunique
What's a good book for learning current C?

~~~
AsyncAwait
I can recommend "C Programming: A Modern Approach 2nd Ed."[1].

1 -
[http://knking.com/books/c2/index.html](http://knking.com/books/c2/index.html)

~~~
ChristianGeek
Even though it was published in 2008?

~~~
AsyncAwait
Absolutely!

There's not a whole lot that's changed in C11, (C is kind of "done" at this
point) and there's not been a newer book that teaches the language so well.

------
abetusk
Some of of these books are not "open source" [0]. For example, "The Boost C++
Libraries" book clearly gives a non-commercial license [1] as does "How to
Think Like a Computer Scientist" [2]. I haven't checked them all but a lot of
look to be under a free license [3] [4], so maybe the majority of them are
actually under an open source license.

    
    
        [0] https://en.wikipedia.org/wiki/Open-source_license
        [1] https://theboostcpplibraries.com/
        [2] http://greenteapress.com/thinkcpp/index.html
        [3] http://opendatastructures.org/ods-cpp/About_this_document.html
        [4] http://www.network-theory.co.uk/about.html

------
asitdhal
The best place to master c++ is StackOverflow. Many people share knowledge
accumulated from experience and they explain much better than Herb Sutter or
any gray beard people in C++ community.

Another important thing, no matter how many books you read, you can't be a
master without actually solving a lot of problems.

~~~
pvg
SO is a great resource but it's about as good a place to learn something as
Wikipedia is to do serious research.

Questions from learners are often poorly formulated and then poorly answered.
Since many people are just looking for getting their code to run or finishing
their homework, this sort of stuff just piles up without getting fixed.

If you're trying to learn anything non-trivial, don't rely on SO alone.

~~~
yamaneko
SO launched a new feature recently called Documentation. Check out the C++
section [1]. Personally, I'm enjoying it a lot. I think they managed to find a
very concise way of showing the basic grips of a language and some advanced
ones. Most stuff are through examples, which I think works better when you're
already familiar with the language, and just wants to do some specific thing.
From time to time, I find myself on the page surfing through the C++ topics.

[1]:
[http://stackoverflow.com/documentation/c%2b%2b/topics](http://stackoverflow.com/documentation/c%2b%2b/topics)

------
_hao
I've just skimmed through "How to Think Like a Computer Scientist: C++" and
I've got to say it seems like the best intro to programming and C++ I've ever
seen. Definitely better than Bjarne's "Programming Principles in C++" and
others.

~~~
branchless
Bjarns books are dire.

~~~
satysin
Programming Principles and Practice using C++ 2nd Edition (god what a horrible
title to type) is a strange book. It has _a lot_ of great info in it but it is
a _very_ hard read. The first 4 or 5 chapters are ok albeit too wordy. But
then after that they seem to rocket up in difficultly. Not impossible but damn
hard for a beginner.

------
criddell
Can you ever really master C++? I've been at it more than 20 years and I'm
still delighted to learn new things about the language and the library.

~~~
bluetomcat
And that's the real problem with C++. You can spend 20 years solving real
problems with it and still feel like a noob when you take a look at
"idiomatic" template code from the standard headers.

On the other hand, people like Scott Meyers have spent their lifetime and
careers explaining its intricacies, without solving any real problems.

~~~
pjmlp
Unless we are speaking of Go, all programming languages are like that.

Sometimes people think they know their favorite language, but most would fail
a language puzzle quiz.

~~~
bluetomcat
> Sometimes people think they know their favorite language, but most would
> fail a language puzzle quiz.

But that is especially true for C++. People who are confident in knowing it
often lack the fundamental C knowledge (i.e. pointer arithmetic, the complete
C type system, the subtle conversion and promotion rules, etc.), but would
insist on knowing C++ very well just because they know how to define classes,
virtual functions and throw a shared_ptr or a vector or a map at every
problem.

~~~
pjmlp
And most people that say that they know C and how simple the language is,
cannot differentiate between their compiler extensions and what is written in
ANSI C.

Nor can they correctly point out all the cases of expected semantics, UB and
implementation specific behaviour.

Regarding the fundamental C knowledge, part of it just leads to bad C++ code.

------
filleokus
I have experience with Objective-C, C#, and Python and I'm currently learning
C++ for a course in "Advanced C++" at university. I'm using "C++ Primer" by
Lippman et al. and think it's quite nice. It might be a bit to basic,
especially the first few chapters, but I kind of like the exercises in each
chapter.

Have anyone read it and know how it compares to the books recommended in this
article?

------
pvitz
The link to the "Open Data Structures (in C++)" book seems to be wrong. The
book can be found at [http://opendatastructures.org/ods-
cpp/](http://opendatastructures.org/ods-cpp/)

~~~
ShroudedNight
Further to the parent, though it moves away from C++, Pat also teaches an
advanced data structures course for which the notes and assignments are
available:

[http://cglab.ca/~morin/teaching/5408/](http://cglab.ca/~morin/teaching/5408/)
[https://github.com/patmorin/tds](https://github.com/patmorin/tds)

------
reacweb
do you have something more focused on c++11 changes ?

------
doozler
Are these books suitable for beginners or more for an experience programmer
looking to advance their skill?

------
cordite
For absolute beginners, The Rooks Guide to C++ is out there. (It is mentioned
on the article)

Open source at: [https://github.com/jeremyhansen/rooksguide-
cplusplus](https://github.com/jeremyhansen/rooksguide-cplusplus)

Previously discussed at
[https://news.ycombinator.com/item?id=6806598](https://news.ycombinator.com/item?id=6806598)

Full disclosure: I joined as a technical editor on the kickstarter just before
publication.

------
tragomaskhalos
The best way to master C++, although perhaps not the most practical, is:

\- Build a time machine

\- Go back to 1988 and get hold of Bjarne's first book and a Zortech compiler

\- Grow old, tinkering with and constantly keeping tabs on the language's
evolution.

In this way, what seems to the modern neophyte like a massive indigestible
meal is actually presented as a procession of smaller courses, most of which
are an improvement on the ones preceding.

------
veli_joza
Are the two Qt books on the list really worth the effort, considering they
cover old versions? The Qt 5 is already around for 4+ years.

------
jjesus
I didn't see Bruce Eckel's Thinking in C++; the PDF is free:
[http://mindview.net/Books/TICPP/ThinkingInCPP2e.html](http://mindview.net/Books/TICPP/ThinkingInCPP2e.html)

I thought Eckel's book was especially good for someone who already had a
background in C.

~~~
RotsiserMho
Anything that hasn't been updated to take into account C++11 is going to do
more of a disservice than be of help.

------
technologyvault
Has anyone else found it much more efficient to learn C++ (or any other
programming language for that matter) using books like this one, YouTube
videos, and help from forums than sitting in a classroom at a college?

------
0xFFC
Thank you so much,

I have one question though, Is there any pdf version for "The Boost C++
Libraries"? I really need it.

~~~
oscargrouch
I would consider using Chromium internal libraries as a boost equivalent.

Theres a lot of good stuff in there..

Just get: src/base, src/ipc, src/net (and something else you are interested
in) and you are good to go

~~~
0xFFC
They are awesome as far I know too, but I don't know about their documentation
status, Can I find my way out? Boost is very well documented and there is so
much book about Boost, But I don't know about chromium internal lib .

~~~
oscargrouch
Well.. First you can learn a lot from here:

[https://www.chromium.org/developers](https://www.chromium.org/developers)

Then, if you need more, you will have to do it the "hacker way", by reading
the chromium source code.

But hey.. you are a C++ dev, source code should be your stack overflow, and
primary source of "documentation".

hint: The unit test files, can make the "how to use this" much more obvious

------
Undertow_
Would someone care to ELI5 the differences in functionality between C, C+,
C++, and C#?

~~~
Mikeb85
C - Compiled language, imperative, pretty basic constructs (no OO, no GC),
basically portable Assembly

C+ - No idea.

C++ - C with a bunch of stuff added on (mainly OO, other goodies too). Still
no GC.

C# - not related to C at all. It's basically Microsoft's Java, with GC, OO,
higher level constructs, lots of sugar, etc...

------
known
Try reading OSS C++ code and cross check it with C++ FAQ;

------
Chris2048
I'd sooner master rust, which seems to have a lot of buzz around it. the world
has needed a low-level prog-lang that's less painful than C/C++ for a while,
rust may have enough merit to displace a lot of C/C++ dev - I just hope it
gets well standardised, in such a way that C++ isn't.

~~~
adrianN
C++ has an ISO standard. It doesn't get much more standardised.

~~~
Chris2048
It has a few standards, which is the problem.

Furthermore, I'm not just talking about the existence of a standard, but the
_complexity_ of the standard (C++is v. big), and also how much that standard
restricts, and hence results in conformal, predictable code.

~~~
pdpi
> It has a few standards, which is the problem.

You mean C++03, C++11, C++14, C++17? Or something else?

If you mean those, I fail to see the problem. The language isn't dead, so it's
not static, and it evolves over time. Publishing a new standard every few
years is the only way to keep all compilers aligned, rather than each going
off in its own "with extra features!" direction.

~~~
Chris2048
Yes, those. The differences between standards aren't trivial, and often the
older standards have to be maintained.

The standard already has lots of features, including a turing-complete sub-
language.

It is difficult to write code to standard (nothing that works, but is
undefined either), that is safe, no segfaults, memory issue, secure, and all
within a practical budget/timeline.

Just being able to reason about the code more easily helps, or make strong
assumptions (e.g. about safety).

~~~
pjmlp
So?

Do you know by heart the differences between each Ruby, Python, C#, Perl .....
version?

~~~
Chris2048
You're reducing the argument here. qualitative arguments (true/false) over
quantitative (to what degree).

Your argument is similar to: "Hitler is bad, but no one if perfect" \- does
that mean than anyone not perfect is equivalent to Hitler?

Moving on; to focus on python it's not difficult to know the handful of
changes between, say, python 2.5 and 2.7, nor to understand them. py3 is
different, and the fork caused a lot of controversy, there is still resistance
to py3. There is a python-2-to-python-3 tool (could any such thing practically
exist between C++ versions?), but it's not perfect.

A language like Java almost suffers from trying to remain backwards
compatible, yes a) the feature is nonetheless appreciated, and java is heavily
used and praised in 'enterprise' b) Java tends to make breaking changes
rarely, and only when necessary - can the changes between C++ specs be
described the same?

