Hacker News new | past | comments | ask | show | jobs | submit login

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

> The text is full of bloat, for the lack of better word. It's the opposite of crisp writing.

You mean somewhat similar to the programming language the same person developed?

[jeff goldblum laugh]

I'm glad I'm not the only one.

I find Stoustrop's writing quite the opposite, concise, informative and a touch entertaining at moments. But I can understand why you might see it otherwise, to each his own.

You may find his book "Principles and Practice Using C++" [1] more accessible.

[1] http://www.stroustrup.com/programming.html

As someone who knows a number of programming languages more or less fluently, I found that book to be invaluable when I started working in C++ professionally. It's not a book to teach you programming or any of the General concepts of OOP, FP, or the like. It is, however, a great resource for learning C++ assuming you know the high level concepts already.

While it's rather introductory, "A Tour of C++" is a much more concise book. Read that and then maybe look at some Scott Meyers books (I haven't read "Effective Modern C++" but the other entries in the series are good and I'd expect this to be a good place to start after the tour book).

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

That's not entirely fair - it's not just about being first.

K&R may be archaic now, even obsolete. However, for decades it has was held up as a an example of what a good technical/language book could be. You don't have to agree with the assessment to agree with the fact - that this was touted as a very good technical book for various reasons.

There never was a "K&R" of C++. That's not unusual, many languages are in the same boat. If you want to go back to the "firsts" it would be a combination of The C++ Primer and Strousoup, putting them together gave you something that was both more and less that K&R was for C.

I first studied the K&R in the early 90s, and it was already terrible by then. Especially if you wanted to teach anything other than quirky systems programming.

From the software engineering point of view, almost every single code example is terrible. Abundant implicit casts depending on the OS, loops that leak buffered reading between iterations, etc etc.

Just no. Never, ever recommend K&R to anybody as a general programming book neither for C or in general. Only the intro descriptions of language characteristics and important functions of the standard library are any use, and then again even these are extremely obsolete now.

Sure, it was a snapshot in time. By the nineties it was already old. I'm not defending it at all as book to learn C from.

There is, however (like or not), a reason we even now say "X is the K&R of Y". As such it is a bit silly to claim that the only reason K&R succeeded as well as it did was by being early....

True, but it maintains a cult following, for lack of better wording.

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

Strongly disagree.

What's a good book for learning current C?

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

1 - http://knking.com/books/c2/index.html

Even though it was published in 2008?


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.

Ben Klemens' 21st Century C is good.

That's his reference book. It's not designed for systematic learning. It's designed as a reference, as in "cut-and-paste stuff". You want one of his other books, meant to take you from zero to literate in not just C++11 but programming in general: https://www.amazon.com/Programming-Principles-Practice-Using...

Bjarne's text is just that, a text, not a read. It should be referred to as a reference. I completely agree with all your accounts because I did EXACTLY what you did a few years ago. I'm still working through the book, but I kinda said "eph it" and enrolled in a solid course. Worth the G I spent? absolutely. THat said, the 'effective' and 'Exceptional' books are well written.

Maybe I suffer from Stockholm syndrome since I read all Bjarne's books, but I really like the book, to the point of having multiple editions of it.

Would you please define which of his books you read? Just saying "Stoustrop's book" doesn't really help anybody. He wrote a few books, as you can see here: http://www.stroustrup.com/books.html

Edited original comment. Sorry for the confusion.

That book works well as a reference, as a supplement to the C++ Primer, 5th Edition.

Not to be confused with C++ Primer Plus.

I think you'd like Accelerated C++ by Koenig and Moo. It's by far my favourite C++ book and it's nice and short.

One drawback may be it's age; it's 17 years old. On the other hand it was way ahead of it's time and good writing doesn't get old.

(ps. I quite like Stroustrup's books but to each their own)

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact