Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Whatever you do, don't look at Bjarne Stroustrup's book, it's terrible. Ignore Andrei Alexandrescu, he tries to turn you into a template metaprogramming zombie. The way to go is to find a subset of C++ which works for you and stick to that.


To know which C++ subset to use on your project, you need first to learn a little about ALL C++.

Alexandrescu and Stroustrup's books will teach you a lot and open you to what is possible in this amazing language.

Weather you will use those techniques in your project however, depends on the project, your team, your clients, etc.


Stroustrup's "The C++ Programming Language" is one of those books which are always around my desk and I still would consider it as the best reference book on C++. I have not read his "Programming: Principles and Practice Using C++", but it is said to be targeted more at people learning C++.

I agree that the metaprogramming stuff in C++ is not something for beginners.


"I agree that the metaprogramming stuff in C++ is not something for beginners."

Or even for most programming problems, in general!

Templates should be used when you are writing a container class. That's about it. Using them for crazy hard-to-read and hard-to-debug metaprogramming purposes is just irresponsible.


What you are saying is that he should not learn C++.


Well, that would be the optimal solution, but, since the author of the post is asking for it... learning a well-chosen subset seems to me the most adequate answer.

For further questions, refer to the C++ Frequently Questioned Answers.


C++ is large, and it is not perfect, but it is very good for a large set of diverse problems. I find pointless C++ bashing (such as the FQA) quite annoying, although it might be somehow amusing to some people, most of whom do not really use C++.

And the subset argument, although it has some truth in it, is misused a lot. Sure, I do not use all of the C++ features, but how can you choose a subset well if you do not have at least an idea of most features? And the well-chosen subset can be different from project to project. I see C++ in a similar way to a large toolset (I mean a metal/plastic/wood toolset, not a software toolset). You don't need to master all the tools in a toolset to do a particular job, but you should have an idea of most of them.


I stayed away from Stroustrup for a long time, but when I finally cracked the spine and really read it, I was surprised at how rich it was. It's not a dry reference, and it's clearly not terrible. If you're doing C++, you should have Stroustrop.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: