3 ms·
The best introductory text to modern C++ is, in my opinion, Accelerated C++ by Moo and Koenig. It's concise and teaches the language instead of spending 6 chapt
by stormbrew 13y ago
The best introductory text to modern C++ is, in my opinion, Accelerated C++ by Moo and Koenig. It's concise and teaches the language instead of spending 6 chapters teaching fundamental algorithms (yet another broken linked list class!) or OO principles (which often results in terrible C++).
- kupo 13y agoThough I also recommend this book, their example code teaches bad habits (such as assignment within conditionals and horrendous compound statements) which should be avoided in any sort of production code.
- city41 13y agoDo you have any examples? I just flipped through the book and couldn't find any. Accelerated C++ was my first ever programming book. It was quite a doozy to get through at the time, but I feel like I'm forever indebted to it. Koenig's attention to detail and ability to explain what the machine is actually doing and the consequences in your code is still unmatched as far as I can tell.
- kupo 13y agomedian = size % 2 == 0 ? (homework[mid] + homework[mid-1]) / 2 : homework[mid]; In my opinion the ternary operator is misused here when an if/else would have been clearer.
- city41 13y agoAh yeah, that is one beefy line of code. I can agree with that.
- banachtarski 13y agoWell, you omitted the all important const qualifier which would be a decent reason to use the ternary operator.
- ufo 13y agoI actually like using the ternary operator in this sort of assignment, so I only need to type the variable name once instead of 3 times. The only real problem in your example is that everything is in one line. It woulf be better to indent that and to add some extra parenthesis to make the precedence clearer.
- sfk 13y agoIs this the book that evolves a student-grading application over 300+ pages? If so, I honestly do not understand why people call this book concise. If you know C already, the pace of the book is so slow that you'll lose interest.
- city41 13y agoIt's more targeted at people who do not know C. Koenig argues that building on C knowledge to learn C++ is a bad idea. They discuss this in the preface of the book.