I have found a mistake: In table 9.1 of chapter 9 "Data types and Conversion" you wrote that the char data type ranges from -128 to 127, but that's not true, because the standard doesn't say that a char is signed or unsigned, it depends on the implementation. A char can be an unsigned char and in that case it will range from 0 to 255.
Well I just skimmed the book but it seems to be incomplete.
Even though it is referring to C++11 it is not talking about language features like:
- lambdas
- Templates (it's referring to the STL at the end though)
Which since this is a contribution based book is not a bad thing. However this book still needs quite some work. Writing a C++ book is not easy.
From all the C++ books I know there's less than a handful which are actually not full of errors and wrong advices.
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 me and I played with it until I understood how it works.
Another good book for beginners is Programming -- Principles and Practice Using C++ by Bjarne Stroustrup, from what I read, he wrote this book with the background of teaching programming at the university and wanted to write a good book which uses a good approach which can be used for teaching students programming in C++.
If you are already further in and not at the beginning of learning C++ there is a list of books I recommend as further readings:
- Effective C++ by Scott Meyers
- More Effective C++ by Scott Meyers
- Effective STL by Scott Meyers
---
- Exceptional C++ by Herb Sutter
- More Exceptional C++ by Herb Sutter
- Exceptional C++ Style by Herb Sutter
---
- C++ Templates - The Complete Guide by David Vandevoorde and Nicolai M. Josuttis
- Modern C++ Design - By Andrei Alexandrescu
- C++ Coding Standards by Herb Sutter and Andrei Alexandrescu
Last but not least, reading the C++ Standard is the last bit on the topic of C++
This is the list of books which I recommend anyone who really wants to become great in C++
HTH :-)
Edit: I should probably mention The C++ Programming Language (4th Edition) by Bjarne Stroustrup as a must have as well ;)
On "GoingNative" Alexandrescu's "C++ Coding Standards: 101 Rules, Guidelines, and Best Practices" was touted as being written out of the real feed-back in the industry. It might be that "good advice for trickier problems", although it isn't a "guide" into C++ (as it assumes you already have a great deal of knowledge and expertise).
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.
Hmmmm. why do you teach arrays before containers? And why is so little if any time spent on the std:: containers (ctrl + f deque returns nothing).
The word template is mentioned 3 times, and never once on how to write your own basic templates (no, that's should not be considered advanced).
Finally, why do you keep using the `.open` member function for your streams rather than specifying the file path in the constructor and then testing the validity of the whole stream rather than individual flags.
You also don't even begin to touch on the standard algorithms. Take for example the book "Accelerated C++". It's only 300 pages, but it has the reader writing modern code with containers and standard algorithms with in the first few pages. It's a much better approach in my opinion.
I first was a backer and then the main guy behind it asked if any of the backers had experience with LaTeX. So I volunteered as a technical editor.
The book seems to be written for those that have _some_ but not extensive programming experience, and have a desire to learn C++ as a real first or second (not fifth) language.
It is still rough, but it has all the content proposed now put together.
For those that don't know programming, but want to get into it: You might want to wait a bit, but it should give a gist of what code can be like.
For those that know programming but not C++: this should be a simple book that you can skim through and start writing (valid) C++ code like a college freshman.
For those that know C++ well: Skip this, this won't teach you anything new. You won't learn the internals of how inheritance works at runtime and how virtual methods are called or anything else cool like that.
Within the next week the repo should be opened up for those that wish to contribute.
not sure. It has some good basic introduction, mainly to syntax, but (imo) leaves out and even goes against quite some good prcatices. If it would include that, instead of just laying out dry theory, it could be pretty good (eg I especially like the C++ FAQ Lite way of explaining why and not just how).
For instance there's a very small chapter on const saying it declares a variable you cannot change. A novice will just read it and forget it. It should (again, imo) say "use const for everything possible" and explain why that is.
Likewise, the strnig chapter starts with saying "use code like using namespace std; string blabla; or you can also use std::string" and leaves it like that without further explanation. A novice might read that, think the first one is less effort and just continue using it. It would be better to make clear the second one has some advantages.
I could go on like that (all loops using post-increment, chapter on array while vector is only covered in the last chapter, chapter on pointers but references are mentioned nowhere, really??, new/delete but no smart pointers anywhere, templates, lamdas or most C++11 features for that matter, ...) but of course there's always a line between introductionary and deeper knwoledge and it's not entirley clear to me where the authors wanted to draw the line. Also there's a lot to tell about C++ of course. Yet, we're in 2013, close to C++14, and C++ has evolved a lot. Large parts of modern C++ programs look nowhere close to what is presented in this book.
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 covers the aspects of memory management and pointers (like the Deitel's "C How to Program"). Then, gradually start C++ with something like Shildt, or again the Deitels. Then, maybe, one day you will want to look at the Stroustrup's book.
Otherwise, learn C# or Java or whatever quacks like a duck.
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.
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.
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 :-)