Live data from Hacker News

The Rook's Guide to C++

rooksguide.org

21–30 of 33 posts

Re: The Rook's Guide to C++

#21

Earlier quoted context omitted.

That is really bad advice. C style memory management is useless in the presence of exceptions, and a nightmare to get right even in C. Choose a book that teaches RAII from the beginning, and leaves C style memory management to a late, advanced chapter. Accelerated C++ used to be that book, don't know if there is a newer and better replacement.

I agree that in modern C++ you need to avoid all the bare-C ways. Actually, my C++ is almost C# if you look at it, especially with the new c++11 standard. But I still believe that to learn C++ the best way is to start with C, pointer arithmetic, and classic strings. Otherwise you will just miss the point and join the hordes of script kiddies who "once started C++".

I agree that understanding of pointer is essential to use C++, but the problem is many learning materials force learners to believe the have to use pointer everywhere - which is opposite in reality…

So there should be a good guidance of avoiding pointers as much as possible when learner is stepping to C++ from C.

Re: The Rook's Guide to C++

#22

Earlier quoted context omitted.

Which books could you personally recommend? I am still searching for a book which gives good advice for trickier problems.

Well it depends on where you stand. For beginners a very good book from my experience is C++ Primer by Stanley B. Lippman, Josée LaJoie, Barbara E. Moo. The 5th edition even goes into the newer topics like the aforementioned lambdas, also variadic templates. A nice thing is that it comes with exercises, which in my particular case was how I learned programming. I found a new feature of the language, or a class new to…

I echo your list of books. I would add Accelerated C++, at least when they get round to making a C++11/14 version.

Re: The Rook's Guide to C++

#23
I would have gone with the C++11/14 syntax right away. C++03 is here to die out, and if you start with C++ there's no reason to learn the old syntax.

e.g. auto keyword, {} initializers, foreach(), lambdas, etc.

Re: The Rook's Guide to C++

#25
post #20
post #7

Holy crap i know a lot more c++ then i thought i did.

My exact feelings, I did c++ in high school with some ancient borland c++ compiler. I always felt I don't know enough of c++ whenever I happen to go through some modern c++ source code. I just realized that is just the STL.

Well, the STL (actually, that term has fallen out of favour , its now The C++ Standard Library) is a core part of the language to the extent that I've often heard it said that if you don't use it, its not really C++ at all. For example, if you use char* for strings (instead of std::string), then you're not actually using STL. If you use arrays instead of containers (std::array, std::vector etc) then its not really C++. Stuff like loops (except I guess the C++11 foreach loops), conditionals, functions etc is all basically just C. The C++ is more than just adding classes - its also adding templates, new semantics (eg move semantics, initializers etc) and the Standard Library.

Having said that, you probably DO know more C++ than you realised :-)

Re: The Rook's Guide to C++

#26
post #6

C++ is a programming language that is used in modern applications primarily for low level tasks like hardware interaction/embedded, games etc. This involves much dedication while learning, and a proper coverage of computer architecture aspects. This is why I do not see much point in learning C++ in a "For Rookies" way "in 21 days". If you want to be a C++ programmer, go find a good introductory C book which properly…

If you want/need to learn C++, learn C++. Learning C to learn C++ is a really poor idea.

There are plenty of people in my office who are like that and they can't see the wood for the tree. Writing out their own for loops instead of using whatever std algorithm would do the job better. Holding their own owning pointers in the presence of exceptions.

The problem is people tend to not to actually learn C++ properly, cover to cover. They just learn the bits they need as an when they need them missing out all sorts of details in the middle.

Re: The Rook's Guide to C++

#27

I would have gone with the C++11/14 syntax right away. C++03 is here to die out, and if you start with C++ there's no reason to learn the old syntax. e.g. auto keyword, {} initializers, foreach(), lambdas, etc.

Agreed. Anything less than C++11 is, IMHO, obsolete and should not be taught to beginners anymore. C++11 is also much more pleasant to work in.

Re: The Rook's Guide to C++

#28

I would have gone with the C++11/14 syntax right away. C++03 is here to die out, and if you start with C++ there's no reason to learn the old syntax. e.g. auto keyword, {} initializers, foreach(), lambdas, etc.

Agreed. Anything less than C++11 is, IMHO, obsolete and should not be taught to beginners anymore. C++11 is also much more pleasant to work in.

I would even drop the "C++11" reference and just keep refering to it as C++. Maybe just mention in the forewords that you need a C++11/14 compiler.

Re: The Rook's Guide to C++

#30

I would have gone with the C++11/14 syntax right away. C++03 is here to die out, and if you start with C++ there's no reason to learn the old syntax. e.g. auto keyword, {} initializers, foreach(), lambdas, etc.

Unless you want to work in VFX for things like physics, cloth / fluid simulation, rendering, etc, where most big studios doing the exciting stuff are running Linux and thanks to Maya and Houdini being built in g++ 4.1, all plugins (and therefore most of the rest of the C++ software stack) have to be built in the same version to match ABI compatibility.
Post reply on HN