Mike and Phani's Essential C++ Techniques
The major problem This book has one killer problem: It is not aimed at C++ programmers. Let me be more specific here; it is not aimed at ANSI C++ programmers. Instead, it is aimed at Microsoft Visual C++ 6.0 programmers.
Is this a big deal? Yes. The cover of the book is rife with mentions of C++. It even mentions ANSI C++. There is one, and only one, reference to Visual C++ on the cover of the book. Even inside, the index lists only three references to Visual Studio, none to Visual C++. With quotes such as 'Hundreds of tips and techniques for advanced C++ programmers' on the cover, I was very surprised to realise this book is for Visual C++ 6.0 users only. At best, the cover of this book is misleading.
The rest of this review (and the book's rating) assumes you are still interested in the book. You therefore use only Visual C++ 6.0 and have no plans to upgrade.
Other problemsFor a book apparently aimed at intermediate and advanced programmers, this book contains a lot of tips that any experienced beginner should already know. Techniques such as ensuring you never return a pointer to an automatic variable really have no place in a book with the stated audience. Really, this book would be more suited to programmers who were still learning C++.
Except there are a number of other issues that make this book poorly suited to people learning C++. Instead of using standard C++ strings, this book chooses NULL-terminated C strings. Files are not included the C++ way (cstdio instead of stdio.h, iostream instead of iostream.h). The STL is not mentioned at all, with dynamic arrays having their own chapter rather than a simple mention of vectors and with an entire chapter devoted to code for sorting instead of showing the programmer how to use the STL sorting algorithms. The smart pointers? Either use the built-in autoptr or use boost.org's vastly superior implementation.
Some good stuffThis book is not completely without redeeming qualities. Many of these techniques are good and useful. If you are a new Visual C++ 6.0 programmer and you are learning from a substandard text, you may find this book covers some of the shortfalls of your other textbook. Similarly, if you are taking a class in C++ and your instructor is particularly lousy, this book could help you out.
SummaryMike and Phani's Essential C++ Techniques is useless to any other than the beginning Visual C++ 6.0 student. It ignores ANSI C++ to focus instead on Microsoft's implementation. It contains a number of stylistic problems, relying far too heavily on C instead of the facilities provided by C++. And finally, it only covers techniques any reasonably experienced C++ programmer should already know.
You can purchase Mike and Phani's Essential C++ Techniques from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
There are a lot of companies still using VS C++ 6.0, and alot don't want to upgrade. The complaints I got from some users for rolling out .NET on their new workstations was unbelievable....
It would have been nice to have more details on how the book was soooo heavily bent towards VC++. I would assume by the fact that he makes such a big deal out of it that these references are such that it wouldn't do any good for a non VC++ programmer? Are these things specific to the environment (visual studio, debugging, etc) or the OS (win32 api, m$ specific data types, etc).
..." and us having to just take his word for it. Even more so because of the topic and the level at which it is apparently targeted.
Overall, I think his review needs a bit more beef (i.e. more examples) vs just saying "I thought it was blah
Nothing with the language itself.
I assume that the examples use windows-specific libraries and stuff. Like MFC and COM stuff. Or maybe it just discusses the location of various options in the VStudio IDE.
If the book had anything insightful to offer, it really wouldnt matter what flavor implementation the examples are in. I have a really great OpenGL book, for instance, thats full of X-Windows specific examples (like creating and maintaining viewports, etc). Being able to take the ideas to windows is no big thing (cant think of the title of it).
If the book sucks then it sucks because it has nothing to say, not because it uses VC++ as an example. If being VC++ -centric is the only basis for saying it sucks, then the reviewer sucks.
I don't need no instructions to know how to rock!!!!
I've actually come to like Scott Meyer's books, particularly Effective C++ and More Effective C++. These books are aimed at C++ programmers to correct common mistakes, and C programmers making the migration to C++ (hence the first few chapters in Effective C++, prefer new and delete to malloc and free, etc.) The only other C++ books I really use regularly are the STL guide and C++ From the Ground Up. All of these are Ansi C++ oriented (at least there hasn't been anything that didn't work on a Ansi C++ compatible compiler). If a book is aimed at Visual C++, then it should say that in the title. Id be curious to hear what other books people use for reference (besides man pages).
I reviewed it because maybe I could help stop other people from buying the book. I absolutely agree that Scott Meyers's books are excellent. I wish he'd write one on templates and generic programming but Modern C++ Design by Andrei Alexandrescu (with a foreward by Meyers) is good enough for me.
Oceania has always been at war with Eastasia.
In the beginners department you can't beat Accelerated C++ by Koenig and Moo. For more advanced programmers there is Scott Meyers.
It basically means that there are perfectly legal constructs in ANSI C++ that are not allowed in MS Visual C++.
The best example I can name off the top of my head is that something like this is not allowed in MSVC++:And there are things that MS Visual C++ allows by default that it's not supposed to. The most glaring example I can come up with off the top of my head is:As an aside, the Intel compiler is far better.
Education is the silver bullet.
On the other hand, there are some problems with the language and libraries if you try to compile code ported from another compliant compiler.
- for loops do not create a new scope (resulting in error messages if you reuse/redeclare for loop counters). I believe this is fixable with compiler flags in Visual Studio.NET. (Technically it's fixable with compiler flags in Visual C++ 6, but the header files won't compile if you try it.)
- Visual C++ does not support Koenig lookup (good riddance IMHO, except the standard has it so I think Visual C++ should at least have a compiler option to use it). It is implemented for operator overloads, but not general functions.
- Visual C++ doesn't support partial template specialization (which I've really missed from time to time when writing reusable templates).
- Visual C++ can't parse the syntax for declaring a template member function and defining it outside the class body (not to be confused with a member function of a template). All such template member functions must be defined inline, causing some clutter in the class definition.
- The auto_ptr implementation is missing a critical member function (causing me to use it with STLport to get proper functionality of pieces of the standard library). You may be able to solve this problem by purchasing the latest version of the Dinkumware libraries to use with Visual C++. (Dinkumware provided the version of the libraries that ship with VC6.)
I've probably missed stuff. This is just what I've generally run into.A hack is just an idiom waiting for wider use.
It's not as if VC++ corners the market on non-ANSI compliant C++. I don't know of any compiler that is 100% compliant. Even GCC falls short of 100% ANSI compliance. (Ever try to call the stream manipulator "fixed" in GCC 2.9x? It's an exercise in futility, because you simply won't find it.)
I'm probably the last person on earth to jump to Microsoft's defense, but let's not be so quick to deride their compiler prior to pointing out that these deficiencies exist in every C++ compiler under the sun, in one way or another.
Good C++ programmers realize that there is nothing wrong with using C constructs such as null-terminated strings and printf to get the job done. It's obvious the reviewer needs to get a dose of programming in the real world before attempting to set himself (herself?) up as some sort of C++ expert.
I did try to point out that the book was bad even for Visual C++ programmers. It uses old-style C++ (#include , for example), ignores valuable contributions to C++ such as the STL and the standard string class, and generally provides nothing a decent C++ programmer should not already know.
It isn't so much that the examples are targetted for Visual C++ 6.0, it is that the techniques themselves are. It is no good telling me, 'If you set eax from assembly, disable warning 4035' unless I am using Visual C++ on an ix86-compatible processor. It just doesn't translate to any other platform.
Oceania has always been at war with Eastasia.
About a half year ago i was doing some C++ programming, which i haven't been doing as much as of as i'd like to, and I had an idea. It seemed each time I started programming something in C++, I would have forgotten some of the details of the language. I wanted a reference card for C++. I searched all over the internet for free ones, and even some I had to pay for. but there weren't any!
So i wrote one. It includes all the common syntax, plus a lot of advanced reference such as library functions.
gbook.org/refcard
This post is going to get modded down, but I wanted to say how much I like the concept of a one sheet reference card better than reference books.
http://github.com/gbook/nidb
SFAIK variable scope is a bit weird in ANSI C,
for(int i;...){
}
i=123;
is valid ANSI C (for some strange reason)
for(int i;...){
j
}
j=123;
is not valid
{
for(int i;...){
}
}
i=123;
is not valid
the same is true for if and switch
this is a pain because of reuse.
for(int i;...){
}
for(int i;...){
}
is invalid ANSI C because i is still in scope in the second for loop.
thank God the internet isn't a human right.
If MSVC is your only environment try here for tips and pointers. They cover a lot of other stuff as well. For pure C++ then as others have said go with Myers / Stroustrup etc
Do not try to read the dupe, thats impossible. Instead, only try to realize the truth
What truth?
There is no dupe
It is an old book: September 1999
NullPointerException
Read a good beginner's book about C++ and update your card accordingly. It's got more problems than I care to enumerate, and that's in sample sections only.
When I took an object oriented course a couple semesters ago, it used C++. I started out the course using gcc-2.96 on Redhat 7.3. Unfortunately, the teaching assitant was using MS visual studio 6. There were no compiler stipulations in the syllabus for the course either.. by the time the first project got graded, there was a ton of confusion.
0 compile errors on gcc, and like 50 in VS. I found out that where Linux let me to declare the std namespace in the main file where I had all my includes, VS wanted the namespace declared in every file to use anything from the STL. There was also other little stuff, but nothing tooo bad.
I couldn't spend all semester like this, so I picked up a copy of VS. After using it for the rest of the semester, my conclusion was: bleh. It was okay, but nothing to write home about and I missed the command line tools.
--------
Free your mind.
God bless slashdot. Anytime I need a good dose of revisionist history, I know where to look.
The library for 2.x (the part responsible for streams) predates the ANSI/ISO standard. It's full of "this is our best guess at what will eventually be voted on, based on the last meeting" code.
When the standard was finalized and published, the 2.x library was dropped, and a new one started from scratch. When GCC 2.x was shipped, its library was already known to be wrong, but stable and "mostly good enough". And the new one was already in the works.
For that matter, large chunks of the 2.x compiler itself had been abandoned for 2.x, knowing that it would be better to rewrite it for 3.x completely.
Boggles my mind why people expect a four-year old product to conform to a four-year old standard. (Hint: it takes a while after the standard is published to write the code.)
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
This all matters particularly in C++ because, unlike in C89, the definitions are mixed in with other statements. C99 allows the mixing, and you may expect to see similar rules surface for C99.
For all this trouble, you get a compiler that isn't much improved. It still tells you to call Microsoft customer support at the first non-trivial use of C++. It still doesn't like non-inline template specialization.
This is, by far, the worst book review ever on Slashdot. The book gets a 2/10 from someone who obviously has no use for Visual C++, which tens of thousands of professionals use daily. His primary gripe seems to be that the cover misrepresented what was inside. What kind of idiot spends $50 on technical book without examining its contents? I'm likely to read at least 20-30 pages of the book before purchasing to make sure it fits my needs and most programmers I know are the same way. I think the primary problem here is that the reviewer wasn't a member of the authors' intended audience and thus it had no value to him. I haven't even heard of the book before seeing this review and the reviewer might be right, it might totally suck. The point is though, noone should take his word for it because he didn't have any use for the book in the first place.
There are dozens of books that are more than suitable for the reviewer and his expectations. When the reviewer fails to properly identify the book's audience and it's value to that audience, they aren't doing anyone any favors. What kind of review do you think a romance novelist would give to Stroustrop's C++ book? They obviously aren't the audience the author intended and as a result, their review isn't worth the paper they wrote it on. If you get a book and find that you aren't in the intended audience, you are doing a severe injustice by providing a review. You won't be able to fully ascertain how useful the book actually is and thus won't be able to provide an insightful review. I don't ask my wife for her opinion on programming books and she doesn't ask for my opinion when it comes to interior decorating. In the same vein, I don't want Chris Thompson's opinion on this book.
string thing.
the string tempaltes are good, but sloooowww as hell.
If you were taught C++ like peeps are taught Java and you've been using std::string in a was that copyies and allocates data all the time then being shown how to use \0 strings will improve you codes memory and speed preformance.
I know people who do C++ 'programming' but wouldn't know how to use structs and function pointers in C to make 'classes'.
thank God the internet isn't a human right.
Authors: Michael Hyman and Phani Vaddadi
Publisher: APress
Copyright: 1999
ISBN: 1-893115-04-6
Pages: 300
Now read that "1999" bit again. How, exactly, did "standard" C++ look back about 3.5 years ago?!
What did you expect? Hell, many modern C++ features weren't even implemented by most available compilers in 1999.
42. Easy. What is 32 + 8 + 2?
Let's say it did. Current GCC incarnations honor std namespace conventions way too much according to the always-changing standard, IMHO.
Let me explain and give you an example:
(I'm sorry I had to replace spaces at the beginning of lines by dots or Slashdot's <ecode> would simply eat them..)
This code won't compile. You're required to put an application-supplied utility function in namespace std (remove the comment markers above) or it just won't compile.
That's GCC 3.2 for you. :-( I'm not sure
whether it is to blame because of following strange
standard requirements, but IMHO you should not be
required to put custom functions
into namespace std just to output some data.
I mean: Polluting std namespace because of this?
Any ideas, btw?
42. Easy. What is 32 + 8 + 2?
I am continually surprised at how often people complain about the for scoping bug in msvc.
For years, I have used a simple fix to get around it:
#define for if(false) ; else for
this gives the correct semantics, no matter the usage.
you can't do:
#define for if(true) for
because then the following would not give the intended result
if(x==2) for(...) doSomething();
else doSomethingElse();
(not really clear code, but still valid, and the previous #define example allows it)