How Not To Program In C++ Book Review
Submitted by Ty on May 8, 2003 - 11:12am.
| Date | |
| May 8, 2003 | |
| Review by | |
| Matt | |
| Name of the book | |
| How Not To Program In C++ | |
| Price | |
| $24.95 | |
| Cover type | |
| Paperback | |
| Number of pages | |
| 280 | |
| Author(s) | |
| Steve Oualline | |
| Publisher name | |
| No Starch Press | |
| Provided by | |
| No Starch Press | |
Introduction
For all you folks that sat for hours when you first stumbled across the joy that is "fortune", or for the ones of you that get a small thrill from announcing to your friend "that's the problem, that line there!" after they've just spent several hours slaving over lines of code trying to debug their program - I think you'll like this book.What's In A Book?
To be honest, I was not entirely sure what to expect when this book first arrived along with the mail (the snail kind) and if I'm being honest I'm still not entirely sure what makes up the 280 pages of content that it is. I found myself leafing through the book page by page wondering exactly this and came to the following conclusion - the book consists of source code and humorous tales and comments. That isn't to say that this is a bad book in any way, but if you are looking for a reference book or tutorial book regarding C++ then this book isn't for you. This book reminds me of the number puzzle books I used to have as a child, more something to distract your mind for a while than anything truely productive, they are still fun though.Fun? Is This Book About C++ Or Not?
Yes! There is source code from 114 different programs listed in the book, only 3 of which actually "work" as expected, so what do the other 111 do? Each program has a flaw in one way or another, some more serious than others, ranging from simple to diagnose, even for the moderately inexperienced programmer, all the way up to three or four page behemoths consisting of classes, pointers, objects and - to make things interesting - multi-threading and semaphore problems. Not for the faint of heart. Thankfully, included is a full set of hints to help you on your way, reminiscent of the adventure books of the 1980s where you are told to "go to" a page to continue the quest with your choice of action, not very similar but the reference is there I'm sure. Along with an extended set of handy hints are included a set of answers to the problems set, explaining what happens in each case and why, including resolutions for each problem and working code where necessary.Example
OK, as an example let us take a look at the first program listed in the book as having a problem. Program 1: Hello World
#include
void main(void)
{
std::cout << "Hello world!\n";
}
Now, I have to admin that I did not spot the mistake at first glance so I decided to write the program out and compile it, if for no other reason than to include in this review. It was a long and gruelling task which took many hours. Thankfully however, I have now recovered and am ready to compile it up, so what does G++ have to tell us about the above source code?
matt@localhost:~$ g++ -Wall -o helloworld helloworld.cc
helloworld.cc:4: `main' must return `int'
helloworld.cc:4: return type for `main' changed to `int'
matt@localhost:~$
Lo and behold, that is what the book says aswell - marvellous. Shame on me for not spotting that one though.
