×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Mike and Phani's Essential C++ Techniques

timothy posted more than 11 years ago | from the caveat-lector dept.

Programming 195

Reader yamla writes with the following review of Mike and Phani's Essential C++ Techniques from APress. Yamla finds a few bright spots in this book, but also several weaknesses. Read on to see whether you fit into the group he says would find this book useful.

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 problems

For 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 stuff

This 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.

Summary

Mike 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.

cancel ×
This is a preview of your comment

No Comment Title Entered

Anonymous Coward 1 minute ago

No Comment Entered

195 comments

Neg bottoms plz reply! (-1, Troll)

Anonymous Coward | more than 11 years ago | (#5241599)

burly poz top in search of skinny neg boi for raping and breeding. into fisting, watersports, toys, shitplay, and gang-bangs. very curious to try new things! bareback only please. email pater@slashdot.org to arrange a hookup!

fp (-1, Offtopic)

Anonymous Coward | more than 11 years ago | (#5241603)

pf.

Almost... (-1, Troll)

Anonymous Coward | more than 11 years ago | (#5241614)

Almost as good as the stuff at Digitalteenz [digitalteenz.com]

although (3, Insightful)

REBloomfield (550182) | more than 11 years ago | (#5241620)

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....

Re:although (0)

Anonymous Coward | more than 11 years ago | (#5241680)

VS.NET EA is a much nicer environment if you just dont install the bloat. C# owns.

I know companies that are still sticking to Visual studio 4, which is basically a nightmare to use.

Pitty VS.NET has WPA, why do they want to cut out those that develop for theyre platform and give it value? Yes its too bloody expensive, atm I am using SharpDevelop IDE and the .NET runtime compiler.

Re:although (0)

Anonymous Coward | more than 11 years ago | (#5241702)

Free IDE (beta atm but looking a good start for students and so on)

SharpDevelop IDE

What other free IDE's are there for .NET? C# specifically for me.

LOWER THE DAMN PRICE OF "VS.NET EA".

Re:although (0)

Anonymous Coward | more than 11 years ago | (#5241714)

Sharp Develop link http://www.icsharpcode.net/OpenSource/SD/Default.a spx

Re:although (1)

yamla (136560) | more than 11 years ago | (#5241808)

This is certainly true. That said, I see little advantage from sticking with Visual C++ 6 compared to Visual C++.NET or .NET2003 (which, of course, isn't out yet). You can easily ignore the .NET part of VC++ and just be happy with the improved standards-compliance.

Compatibility nightmare (3, Interesting)

iamacat (583406) | more than 11 years ago | (#5242480)

.NET uses it's own C runtime (msvcrt70.dll) and MFC DLLs. Worse, VC6.0-compiled libraries are not compatible with new runtime. Even DLLs that use their own runtime/MFC will not work, because MFC data structures have changed and malloc'ed memory blocks returned by the DLL can not be freed by the application, since there are two different version of heap management code. If you use any third-party component in your program (condmgr.dll anyone?), welcome to hell.

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.

Re:although (0)

Anonymous Coward | more than 11 years ago | (#5242127)

You therefore use only Visual C++ 6.0 and have no plans to upgrade

I wonder what the reviewer thinks of Visual C++ as a tool. It's not like there's any hint of distain for it in the review.

Yay (-1, Offtopic)

Anonymous Coward | more than 11 years ago | (#5241621)

U.S. Secretary of State Colin Powell, at the eleventh hour, has altered his presentation to the U.N. Security Council to try to satisfy the concerns of Congressional Democrats, as well as U.S. critics elsewhere in the world.

Previously, Mr. Powell planned to show images and documents demonstrating that the Iraqi government has weapons of mass destruction and is deliberately deceiving U.N. inspectors.

However, the White House has become convinced that even with such evidence, the U.N. and Democrats in Congress will still oppose action to disarm Saddam Hussein.

So, instead, Mr. Powell will present the following accusations against Iraq:

--Saddam Hussein personally owns guns, and uses them.
--Iraq produces oil, the combustion of which will doom the planet to a second ice age.
--Saddam supports the death penalty and uses it.
--Some Iraqis, including government officials, drive Sport Utility Vehicles (SUV).
--Saddam believes Iraq is better than other countries.
--Saddam is decisive, often seeing issues in black-or-white terms, rather than countless shades of grey.
--Many Iraqis are meat eaters.
--Many Iraqis are "pro-life," opposing abortion.

A few Democrats who have previewed the script for the presentation expressed outrage at Iraq, and wondered why President Bush has not previously gone public with this "damning evidence."

"We are ready to authorize the use of overwhelming force," said one unnamed Senate Democrat. "This crazed dictator must be stopped before his ideas spread throughout the region."

help (-1, Offtopic)

Anonymous Coward | more than 11 years ago | (#5241623)

been sitting here at my freelance gig in front of a Mac (a 8600/300 w/64 Megs of RAM) for about 20 minutes now while it attempts to copy a 17 Meg file from one folder on the hard drive to another folder. 20 minutes. At home, on my Pentium Pro 200 running NT 4, which by all standards should be a lot slower than this Mac, the same operation would take about 2 minutes. If that.

In addition, during this file transfer, Netscape will not work. And everything else has ground to a halt. Even BBEdit Lite is straining to keep up as I type this.

I won't bore you with the laundry list of other problems that I've encountered while working on various Macs, but suffice it to say there have been many, not the least of which is I've never seen a Mac that has run faster than its Wintel counterpart, despite the Macs' faster chip architecture. My 486/66 with 8 megs of ram runs faster than this 300 mhz machine at times. From a productivity standpoint, I don't get how people can claim that the Macintosh is a superior machine.

Flame me if you'd like, but I'd rather hear some intelligent reasons why anyone would choose to use a Mac over other faster, cheaper, more stable systems.

Re:help (-1, Offtopic)

Anonymous Coward | more than 11 years ago | (#5241725)

Are the two folders on two different volumes?

If they are on the same volume on NT, it should take a lot less than 2 minutes.

Mike an Phani's C Techniques (-1, Offtopic)

stratjakt (596332) | more than 11 years ago | (#5241625)

Am I the only one who thinks that sounds like a really, really, really lame comic strip for geeks.

Difference between MS and ANSI? (1)

gpinzone (531794) | more than 11 years ago | (#5241636)

Mike 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.

I'm not a C++ programmer, but I'm very curious to know what the diferences are between ANSI C++ and MS Visual C++.

Re:Difference between MS and ANSI? (2, Insightful)

stratjakt (596332) | more than 11 years ago | (#5241684)

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.

Re:Difference between MS and ANSI? (4, Interesting)

yamla (136560) | more than 11 years ago | (#5241849)

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.

Re:Difference between MS and ANSI? (1)

Curien (267780) | more than 11 years ago | (#5242646)

> Nothing with the language itself.

Not true. MSVC++6 falls far short of the mark WRT compliance to the C++ language definition. Further, there are many features of the VC++ language that simply do not exist in the C++ language (declspec, __int64, all the functions in C headers that start with an underscore, etc).

Re:Difference between MS and ANSI? (-1, Redundant)

TheJesusCandle (558547) | more than 11 years ago | (#5241717)

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).

Overall, I think his review needs a bit more beef (i.e. more examples) vs just saying "I thought it was blah ..." 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.

Re:Difference between MS and ANSI? (1)

Lazar Dobrescu (601397) | more than 11 years ago | (#5241830)

Heh, I heard about stealing comments from another article in a desperate attempt to get karma, but this is the first time I actually notice someone doing in within the same article [slashdot.org] ...

Ah karma, is there any thing people won't do for you?

Re:Difference between MS and ANSI? (5, Informative)

Viking Coder (102287) | more than 11 years ago | (#5241752)

Microsoft is not particularly ANSI C++ compliant. And it's STL implementation is fairly lousy. That makes it hard to both port code TO and FROM MSVC++, because you expect certain standardized behavior, and Microsoft's implementation of C++ is not correct in all cases. (Note that, until fairly recently, NO C++ implementation was ever "correct" according to the standards.)

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++:
template <class Type>
Type myFunction()
{
Type result;
// do calculations at the precision of Type
return result;
}

int r = myFunction<int>();
// supposed to be allowed in ANSI C++,
// but it isn't in MSVC++. They just can't
// parse it, for whatever reason.
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:
// do something in a loop with variable i
for (int i = 0; i < 10; ++i)
{
}
int other = i;
// re-use the variable i - NOT ALLOWED
// i is supposed to lose scope after
// the above for-loop
As an aside, the Intel compiler is far better.

the for loop thing (2, Informative)

oliverthered (187439) | more than 11 years ago | (#5241908)

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.

Fixed in ANSI 96 (0)

Anonymous Coward | more than 11 years ago | (#5242241)

Basic.Scope. [rwth-aachen.de]

4 Names declared in the for-init-statement, and in the condition of if,
while, for, and switch statements are local to the if, while, for, or
switch statement (including the controlled statement), and shall not
be redeclared in a subsequent condition of that statement nor in the
outermost block (or, for the if statement, any of the outermost
blocks) of the controlled statement; see _stmt.select_."

earlier ANSI definitions didn't include the
"(including the controlled statement)" bit.

You mean C++ (1)

kyz (225372) | more than 11 years ago | (#5242319)

you can only declare variables at the start of a block in C, eg for(...){int i;...} or {int i; for(...){...}}

Re:the for loop thing (1)

olethrosdc (584207) | more than 11 years ago | (#5242542)

Yes, because the preprocessor does this translation:

for (int i;..) {
}
blah;

>>>>>>>>>>>>>. .
int i;
for (i; ..) {
}

Instead of
{
int i;
for (i;...) {
}
}

Re:Difference between MS and ANSI? (0)

Anonymous Coward | more than 11 years ago | (#5241941)

Both of your examples are simply not true for vc7.

Re:Difference between MS and ANSI? (0)

Anonymous Coward | more than 11 years ago | (#5242407)

Good thing we're talking about VC++ 6.0 then.

Re:Difference between MS and ANSI? (1, Informative)

spectecjr (31235) | more than 11 years ago | (#5241954)

Both your examples work great with the current Microsoft compiler. Especially the for-loop issue, which actually causes more problems than it solves if you're at all trying to optimize things, but hey. At least you can turn it on/off with a switch.

Simon

Re:Difference between MS and ANSI? (1)

Dr. Photo (640363) | more than 11 years ago | (#5242637)

Especially the for-loop issue, which actually causes more problems than it solves if you're at all trying to optimize things, but hey. At least you can turn it on/off with a switch.

Or you could do the Right Thing and declare your counters before the loop body. Has the added effect of not re-instantiating a new variable for each (outer) iteration of a nested loop.

Re:Difference between MS and ANSI? (1)

hackstraw (262471) | more than 11 years ago | (#5242073)

I've never understood the for (int i... bug/feature. Actually, it seems correct that i would not be in the scope inside the braces, because its not inside the braces. Also, what should this scope be?
for (int i = 0; i<10; i++) j += i;
or this...
while (1) int i = x, break;
Is there a loop scope as opposed to a block scope in C++? But I haven't written C++ code in a while, and am not sure (nor does it seem like anyone else) knows what the spec is for C++.

Re:Difference between MS and ANSI? (0)

Anonymous Coward | more than 11 years ago | (#5242671)

Ok, I've just tralled the ANSI C++ spec, ahhh my head hurts.

as-of ANSI 96 (still draft?)

if(condition) int i;
is the same as
if(condition){int i;}

that is the i only has the scope of the if statement.

I'm not sure about this though

if(function(int i=123)){

}

Is i still inscope in the if statement? the ANSI spec gets very fluffy.

96 the scope of i was undefined in
if(int i){
}

some pre-processors do
{
int i;
if(i){}
}

some do
int i;
if(i){}

Re:Difference between MS and ANSI? (2, Interesting)

Gortbusters.org (637314) | more than 11 years ago | (#5242152)

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.

Re:Difference between MS and ANSI? (1)

Dionysus (12737) | more than 11 years ago | (#5242365)

What do you mean by declare? GCC-2.96 was a bad C++ compiler. C++ headers weren't in the std namespace (or you could access them without including the namespace).

I believe VS 6 was more standard compliant than GCC-2.9x series (GCC 3.x series are even more compliant, but then so is VS .NET)

Re:Difference between MS and ANSI? (1)

kaphka (50736) | more than 11 years ago | (#5242526)

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.
Perhaps that's because gcc completely ignores the std namespace. Your code would have compiled under gcc even if you hadn't mentioned std once. See here [gnu.org] . (Look for "-fhonor-std".)

Re:Difference between MS and ANSI? (0)

Anonymous Coward | more than 11 years ago | (#5242473)

How about this
class Foo {
public:
operator= ( int rhs ) {
val_ = rhs;
}

int val_;
};
this is WRONG! operator=() MUST return a reference to the object instance. Yet the MS C++ compiler will happily accept this.
it should be
class Foo {
public:
Foo& operator= ( int rhs ) {
val_ = rhs;
return *this;
}

int val_;
};

#define for if (false); else for (1)

iamacat (583406) | more than 11 years ago | (#5242576)

Here goes your for scope problem. I compile all my code like that to be compatible with CodeWarrior.

As an aside, where is that famous Intel compiler and what kind of UI toolkits for Windows does it support? I want GNUStep :-(

Re:Difference between MS and ANSI? (1)

j_kenpo (571930) | more than 11 years ago | (#5241765)

Very little. I have, however, had situations where Ansi C++ compilers would compile a program (very simple console programs mind you), and Visual C++ would not. It would whine about the class definitions and such. Overall though, the sytax is almost the same.

Re:Difference between MS and ANSI? (5, Informative)

alefbet (518838) | more than 11 years ago | (#5241783)

Microsoft Visual C++ has a few extensions to the language, mostly inherited from its extension to the C language, and nothing you can't get by without (unless you are looking at its "WinMain" function or other extensions designed specifically for programming under windows).

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.

Mmmm. Tasty O'Reilly... (1)

alaric187 (633477) | more than 11 years ago | (#5241637)

I'm sure that this is redundant, but C++: The Core Language by Gregory Satir & Doug Brown is a really good C++ for beginners book or "The Weasel/Skunk/Whatever that is Book".

Bright Spots? (0, Redundant)

Sebastopol (189276) | more than 11 years ago | (#5241638)

I didn't see any "bright spots" in the review. Sounds like a waste of time and money. If they aren't mentioning STL, why would you even review it?

It's funny how many crappy books on C++ dribble from the presses like a chowdery diarrehea. Sorry for the analogy, but I've seen waaaay too many books just like the one the reader describes.

Stick with Scott Meyer's books, you really can't beat 'em.

Re:Bright Spots? (3, Informative)

yamla (136560) | more than 11 years ago | (#5241724)

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.

Re:Bright Spots? (1)

renehollan (138013) | more than 11 years ago | (#5242563)

yamla posteth: "...Modern C++ Design by Andrei Alexandrescu ... is good enough for me."

Oh yeah. That is one book that separates the C++ hard-core hackers from the wannabes.

The hard-code programmer will read that book and smile.

The wannabe will run away, crying for mother.

Best US$40 I spent recently. If you're serious about advanced C++ (and I don't use the word advanced lightly -- templates form much of the foundation of what he does, and, are not represented as an "advanced" technique in and of themselves, for example), I recommend it highly. The introductory section on "Techniques" alone is worth the price of the book -- it will leave you smacking your head thinking, "What a cool language hack!"

As an appetizer, his discussion of type traits helps answer the age old question of what to do when you need to abstract semantics, and/or deal with the fact that you have a particularly efficient implementation of a given interface for restricted semantics on a given platform, and still want to write portable code that accomodates it.

I hear that compilers secretly refer to Alexandrescu as the Marquis de Sade.

heh (0, Troll)

hfastedge (542013) | more than 11 years ago | (#5241650)

for such a crufty and complex language, you probably do need these essential techniques just to be able to program.

More specifics on VC focus (4, Insightful)

binaryDigit (557647) | more than 11 years ago | (#5241656)

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).

Overall, I think his review needs a bit more beef (i.e. more examples) vs just saying "I thought it was blah ..." 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.

Re:More specifics on VC focus (2, Informative)

koh (124962) | more than 11 years ago | (#5241729)

The most common form of "bending towards VC++" is to give many examples that use ClassWizard's "features".

For instance, if you read the developper's guide from Microsoft and lookup how to bind an event to, say, a button, the devguide will advise you to double-click the button in the dialog editor then use ClassWizard's moronproof dialog boxes, instead of directing you to add a method and a message map entry to your container class...

This IHMO heavily contributes to the fact that many people now can't understand how C++ frameworks work. They're only able to invoke ClassWizard and let it do the job. Of course, there are things ClassWizard cannot do, but in that case... they won't implement the feature at all and whine about "support not present".

Re:More specifics on VC focus (4, Informative)

yamla (136560) | more than 11 years ago | (#5241782)

I initially included examples of how it was bent so completely toward VC++ but it really made the review hard to read.

It is comments such as 'Always use at least warning level 3', with information on how to select it in Visual C++ but without any note that this isn't an ansi-C++ technique, that really annoyed me. The book is littered with techniques that would only work in Visual C++ (and only with Visual C++ 6.0). There are sixteen chapters and I was able to find several examples in pretty much every single chapter. This was all the worse because the book appears to be targetted at ansi-C++.

Bad for most peoples (1)

Achmed Swaribabu (642441) | more than 11 years ago | (#5241669)

I think this kind of approach leads to bad coding techniques for most peoples. One should learn the hard core basics and make big study of algorithms and traditional coding practices before moving into tips and tricks.

What goes bad is that peoples like to skip past the boring stuff and try to write advanced code which leads to big maintenance mess.

I only code in C with proven and time tested princilpes and my code is as bullet proof as it gets. So many times you see bad coder write with too many tricks while trying to break the Olog(n) speed barrier and end up with big mess. Don't you be tempted.

Advanced Visual Studio C++? (1, Flamebait)

gammoth (172021) | more than 11 years ago | (#5241688)

Visual Studio C++ and advanced programming are mutually exclusive.

All Visual Studio C++ programmers, advance yourselves onto a professional platform with a quality API.

Re:Advanced Visual Studio C++? (1)

spectecjr (31235) | more than 11 years ago | (#5242005)

All Visual Studio C++ programmers, advance yourselves onto a professional platform with a quality API.

Don't you mean "onto a platform with thousands of variable quality APIs for the same thing"?

Simon

Re:Advanced Visual Studio C++? (0)

Anonymous Coward | more than 11 years ago | (#5242062)

All Visual Studio C++ programmers, advance yourselves onto a professional platform with a quality API.

Such as ...?

Not trolling, just about to learn C++ ... :)

Scott Meyers (3, Interesting)

j_kenpo (571930) | more than 11 years ago | (#5241713)

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).

Also, the "C++ In Depth" series (1)

devphil (51341) | more than 11 years ago | (#5242309)


Dr. Stroustrup is the series editor for these books, and damn, they are good. A comment by Kickasso suggests the most excellent Accelerated C++, but it's not just for beginners. (Well, it's targeted for beginners, but it's also an excellent book for experts; it helps to simplify an otherwise complex environment. Kinda like studying Zen.)

Anyhow, that book is part of the In Depth series. They're easy to recognize: all red with yellow titles, and -- an important part -- all small. One of the series' rules is that the main body text must be no more than 300 pages. No more gigantic tomes of crap.

Kickasso reviews 99.99% of all C++ books at once! (4, Informative)

Kickasso (210195) | more than 11 years ago | (#5241737)

They are crap.

In the beginners department you can't beat Accelerated C++ [acceleratedcpp.com] by Koenig and Moo. For more advanced programmers there is Scott Meyers.

Re:Kickasso reviews 99.99% of all C++ books at onc (1)

monadicIO (602882) | more than 11 years ago | (#5242691)

They are crap.
It's also a comment on a language so obfuscated that 99% of the books don't seem to get the descriptions right. If it were a sensible language, one book (ok, perhaps 5 - 6) would have been enough.

Dudes.... (0)

Anonymous Coward | more than 11 years ago | (#5241748)

You know our book wasn't suppose to be good or anything, just thick; with lots of cut and paste examples and stuff...

-Michael Hyman and Phani Vaddadi

Not so great (0, Informative)

Rossalina W Sanchez (575882) | more than 11 years ago | (#5241749)

I found this book a curious pot pourri. By no stretch of the imagination is this book going to be much use to its declared readership--advanced C++ programmers. No one in that category needs to be told such simple things as that classes designed with the expectation that they will be derived from should have virtual destructors.

Code in books such as this one should be well written. In many places the authors provide before and after code in support of their guidelines/techniques. What do you think of the following as an 'after' (it does not matter what the technique is that is being written about):

class baseClass {
public:
baseClass() : fltSalary(0.) {}
char *szName;
float fltSalary;
};
It becomes clear, long before the chapter on using Assembly that the authors are writing about C++ on a very specific platform and based on experience with a specific implementation of C++. They have little familiarity with what are rapidly becoming standard techniques among more experienced C++ users. Couple this with a pre- occupation with what I might call micro-optimisations and we finish up with a book that not only offers nothing to advanced C++ programmers, and very little to experienced ones but it also provides a dangerous mindset for inexperienced programmers.

What I find frightening is that the authors are clearly writing about the way they write C++ code. Frankly they are, in my opinion, still at the point where they have a good deal to learn about C++ techniques from the real experts of the industry.

Finally let me quote 'Technique 129: Avoid the CRT If You Can' in its entirety. I think that may give you the sense of why I think this book is wholly misguided.

Re:Not so great (1, Informative)

Anonymous Coward | more than 11 years ago | (#5241847)

If you're gonna quote another review, at least attribute the source!

http://www.accu.org/bookreviews/public/reviews/m /m 002067.htm

Re:Not so great MOD PARENT UP (0, Offtopic)

Achmed Swaribabu (642441) | more than 11 years ago | (#5241870)

Why is this marked as a troll?

This is a very good review of the book. I swear you slashdot geeks are nothing but a bunch of women hating nerds.

Re:Not so great (1)

orthogonal (588627) | more than 11 years ago | (#5241920)

Finally let me quote 'Technique 129: Avoid the CRT If You Can' in its entirety.

Is that the entire quote, or did you forget to add the quote?

And what's the CRT (in this context)? Surely not Cathodae Ray Tube?

Aside: I assume your distate for the 'after' example is the public member variables, the use of char* and float as opposed to std::string and double, the non-initialization of the pointer member, and that the ctor doesn't actually set up the object's state? Oh, and the Hungarian notation. And the "C-ism" of attaching the pointer decorator to the variable name, rather than to the type. Or an I missing other problems with it?

Re:Not so great (-1)

Anonymous Coward | more than 11 years ago | (#5241991)

The poster forgot to paste the rest of the review he/she cut-and-pasted from another site.

Re:Not so great (1)

yamla (136560) | more than 11 years ago | (#5242030)

I didn't write the comment you are responding to. However, here is the complete text from that section. I think it is a good example of how this book is not targetted at ANSI-C++ programmers.

The C Runtime (CRT) is a library of common functions used by most programs. It includes start-up code as well as many other functions. It also adds a lot of space to your programs. When you focus on size, you can write you own start-up code and reproduce only the CRT functions you need, thus dramatically lowering the size of your programs.

Re:Not so great (1)

mccalli (323026) | more than 11 years ago | (#5242134)

And the "C-ism" of attaching the pointer decorator to the variable name, rather than to the type.

This always annoys me...

char* x, y; - what is y?
char *x, y; - ah, now we see what y is.

Cheers,
Ian

Re:Not so great (1)

e-Motion (126926) | more than 11 years ago | (#5242441)

This always annoys me...

char* x, y; - what is y?
char *x, y; - ah, now we see what y is.


As a general rule, I don't mix "pointer-to-sometype" variable declarations with "sometype" declarations, because they only save keystrokes at the expense of potential confusion. For the above code, it is probably best to separate the declarations of x and y.

char * x;
char y;

I admit that this is a relatively minor issue that doesn't greatly influence the overall readability of code.

Re:Not so great (2, Informative)

Euphonious Coward (189818) | more than 11 years ago | (#5242477)

In C++, any declaration of two variables in the same definition statement, as described,
char* x, y;
is bad style. The correct code for the example given would be
char* x = something;
char y = something else;
You see there is no confusion about the type of x or y, and no possibility of confusion about whether x or *x is being assigned/initialized. Combining the definitions tempts you to leave out the initializations, which would also be bad style in C++.

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.

Re:Not so great (0)

Anonymous Coward | more than 11 years ago | (#5242498)

While I like and use the "TYPE* var" instead of "TYPE *var", I find the problem you mentioned annoying. So, I dont declare multiple pointer/reference variables on the same line, only non-pointers.

Re:Not so great (0)

Anonymous Coward | more than 11 years ago | (#5242624)

If this book is targetted at VC6 programmers, then CRT is the "C" Run Time library, presumably the Microsoft implementation. One reason to avoid it is that if you would like to compile in "ANSI" mode (i.e. disabled langauge extensions) you CANNOT even hope to compile if you are including the MS CRT headers. Microsoft's own ATL does not use the CRT At all (to the best of my knowledge).

Another querk is that if you want to programm multithreaded programs, and you use the CRT then you cannot/should not use the WIn32 thread creation functions directly, instead you have to use the somewhat confusing CRT thread calls _beginthread, _beginthreadex, as well as not being allowed to use the TerminateThread function. The reasons being that the Win32 API calls can screw up the state of the MS CRT.

I call foul (-1)

YourMissionForToday (556292) | more than 11 years ago | (#5241787)

Reader yamla writes with the following review of Mike and Phani's Essential C++ Techniques from APress. Yamla finds a few bright spots in this book, but also several weaknesses. Read on to see whether you fit into the group he says would find this book useful.

You cribbed this intro from my 2nd-grade book report on The Very Hungry Caterpillar. Plagiarist!

Pot-kettle scenario (2, Insightful)

pongo000 (97357) | more than 11 years ago | (#5241822)

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.

This review only got posted because it was anit-MS (0)

Anonymous Coward | more than 11 years ago | (#5241859)

I'm just suprised Michael didn't jump on it sooner and throw his unqualified opinion in.

Re:Pot-kettle scenario (0)

Anonymous Coward | more than 11 years ago | (#5241893)

try edg.com for the first ever compliant C++ frontend!

Ps. C++ is shit!!

Re:Pot-kettle scenario (0)

Anonymous Coward | more than 11 years ago | (#5241934)

"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."

Sadly, too many people believe C++ is an actual seperate language, and not the simple extension of C that it is.

*shoots some sacred cows*

Mmm, beefy objects.

GCC 2.9x? (1)

Kickasso (210195) | more than 11 years ago | (#5241975)

That's soooo last century. Try 3.2, or something.

Re:GCC 2.9x? (0)

Anonymous Coward | more than 11 years ago | (#5242165)

> That's soooo last century. Try 3.2, or something.

2.95 is still the standard compiler on most distributions. Just because the 'ooooh, shiny' 3.2 is out doesn't mean it's debugged enough to suit the major distro vendors. I'm certain it will be, soon enough, but not right now.

Re:GCC 2.9x? (0)

Anonymous Coward | more than 11 years ago | (#5242259)

Not to mention that visual studio 6.0 is quite
old too.

Re:Pot-kettle scenario (2, Informative)

yamla (136560) | more than 11 years ago | (#5241994)

I would hardly say there is nothing wrong with using C constructs such as null-terminated strings and printf(). I would agree that there are many times that you do want to use such constructs, however, and I often do in my code. However, a book targetted to C++ programmers should use C++ constructs where appropriate. Use a null-terminated string if there's a good reason for it, of course, but otherwise, why not use the C++ string? And why, for God's sake, have a whole appendix on implementing your own string class in C++? It seemed to offer far less than the standard string class and didn't provide any advantages. I can see examining a class like this if you are trying to learn C++ and want a better understanding, but for an advanced C++ programmer?

Re:Pot-kettle scenario (1)

dvdeug (5033) | more than 11 years ago | (#5242180)

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.)

True, GCC is not 100% ISO compliant, but it's really not fair to bring up stuff about 2.9x. 2.95 was released almost five years ago, and 3.0 (its much more compliant successor) was released almost three years ago, with the even more compliant 3.1 (aka 3.2) being almost two years old.

Re:Pot-kettle scenario (3, Informative)

Hortensia Patel (101296) | more than 11 years ago | (#5242200)

> I don't know of any compiler that is 100% compliant

I think the EDG frontend is pretty much there these days. I don't doubt it still has the odd bug, but they do now have an implementation of "export", which has been the real ball-and-chain attached to the leg of any team attempting to hit full compliance. The Comeau compiler (www.comeaucomputing.com) uses this frontend.

Every indication is that the upcoming 7.1 release of the MS C++ compiler will be very good indeed; possibly better than G++. Their attitude to ANSI has really come on in leaps and bounds; I've heard from several sources that even the alpha could build Loki, Boost and Blitz without hacks. Loki in particular is notorious for killing compilers; it is to C++ what TeX was to Pascal.

> Good C++ programmers realize that there is nothing wrong with using C constructs such as null-terminated strings and printf

For quick hacks, sure. For big, critical production systems, I'd say that using printf is verging on professional negligence in this day and age.

> It's obvious the reviewer needs to get a dose of programming in the real world

Now you're just trolling.

Re:Pot-kettle scenario (1)

olethrosdc (584207) | more than 11 years ago | (#5242502)

Hm, so null-terminated strings are
DATA\0

There are also prefix-strings
with DATA or strings with both prefix and termination.

C++ strings are simply object-wrapped versions of either of those types of strings, is not that correct?

Were you expecting time-travel? (2)

devphil (51341) | more than 11 years ago | (#5242462)

Even GCC falls short of 100% ANSI compliance. (Ever try to call the stream manipulator "fixed" in GCC 2.9x?

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.)

Weak book? (1)

Malc (1751) | more than 11 years ago | (#5241867)

"Techniques such as ensuring you never return a pointer to an automatic variable really have no place in a book with the stated audience"

MSVC6 kicks out a warning if you do this. No programmer worth their salt ignores warnings: as a MSVC programmer, at least put a pragma around issues to disable unwanted warnings! ;)

Personally, I've never had a problem with the APIs when developing cross-platform code implemented in ANSI C++ under MSVC6. The MSDN documentation is normally very good about declaring compatibility levels for the libraries. The biggest gotcha that's burnt me with ANSI C++ under MSVC6 was to do with 1) scope of variables in if statements; and 2) exception decoration on function/method declarations.

Plug (3, Interesting)

nycsubway (79012) | more than 11 years ago | (#5241878)

This is time for a selfish plug. but an honest plug.

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 [gbook.org]

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.

Moderator bait - Re:Plug (1)

Malc (1751) | more than 11 years ago | (#5241947)

This post is going to get modded down"

This bugs me when people include comments about being moderated down. Have some confidence in what you're writing. Comments like this often come across as way to *avoid* being moderated down. Personally I do not see why your comment would be moderated below one - there's nothing particularly offensive about it, and it might be of interest to some people. OTOH, if I had some mod points left, I wouldn't mod it up beyond three, although I might mod it over-rated and back down to one just for the commented I quoted above ;)

Re:Plug (0)

Anonymous Coward | more than 11 years ago | (#5241959)

That's by far one of the dumbest things I've ever seen.

It's obvious that you're a state college moron, too.

Dude. (2, Informative)

Kickasso (210195) | more than 11 years ago | (#5242106)

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.

For MSVC development (4, Interesting)

Timesprout (579035) | more than 11 years ago | (#5241914)

If MSVC is your only environment try here [codeguru.com] 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

Ditto for CodeProject (0)

Anonymous Coward | more than 11 years ago | (#5242638)

CodeProject [codeproject.com] is anothe great site for programming tutorials. It features a host of great material on VC++ and MFC. It also has a good user community, and discussion boards relating to all kinds of topics (still mostly C/C++ and VC++/MFC).

I used to go to CodeGuru all the time until I found CodeProject

Top 5 reasons to buy a crappy C++ book (0, Redundant)

Amsterdam Vallon (639622) | more than 11 years ago | (#5241935)

5 -- You won't read it anyway

4 -- It comes out of your company's wallet, not yours

3 -- It's the only language left that doesn't try to be "write once, run on any toaster oven"

2 -- You still can't figure out how pointers work

1 -- It's still less crappy than the writing on Slashdot

Another joke courtesy of *nix.org [starnix.org]

Shit.. will you mods wake up? (-1, Flamebait)

Anonymous Coward | more than 11 years ago | (#5242467)

This confims my suspicion, the slashdoters who mod don't know YHBT, are frequently fooled by trolls, don't read someones history, don't think before moding ([scarcasim]Does any one here?[/scarcasm]), can't reconize a name that has appered in just about every article so far posting "top 5 blah blah" karma whoring jokes (speaking of which, that reminds me of someone's [slashdot.org] BS "good/bad news for linux" trolls), etc.

lol...MOD PARENT +1 FUNNY (0)

Anonymous Coward | more than 11 years ago | (#5242600)

rotflmao

To late. (1)

demigod (20497) | more than 11 years ago | (#5242024)

I just bought that book... Why couldn't you have written this review last week :-(

I saw it for $5.99 on the discout rack...
I'd say you get what you pay for, but I got a lot of good O'reilly for $5.99 off the discout rack.

Re:To late. (1)

yamla (136560) | more than 11 years ago | (#5242051)

I did write it last week, it just took slashdot a while to get around to posting it. Sorry about that but I imagine things worked out positively for you if you were able to get some O'Reilly books for that price.

Re:To late. (1)

1st1 (578775) | more than 11 years ago | (#5242096)

Thought it was just /. who had delayed the review for 3.5 years. (The book is quite old)

Nitpick (1)

Chocolate Teapot (639869) | more than 11 years ago | (#5242483)

Instead of using standard C++ strings, this book chooses NULL-terminated C strings.
I take it you mean STL strings? Apart from those, I cannot imagine what you mean by standard C++ strings. If that is what you mean, I have to point out that STL strings are no more 'standard' than the null terminated variety. From the review I would hazard a guess that the book makes no reference to the Standard Template Library. Nice heads-up though. I get pretty tired of books that don't acknowledge life outside the M$ development environment.

What was I thinking ^&%#^%@ (1)

Chocolate Teapot (639869) | more than 11 years ago | (#5242561)

Bad form replying to my own post, but I will preempt the flames.
From the review I would hazard a guess that the book makes no reference to the Standard Template Library
The review stated quite clearly that The STL is not mentioned at all. That's what I get for talking on the phone, drinking coffee, eating doughnuts and posting on /. at the same time. I stand by the rest of my comment though.

Re:Nitpick (1)

spakka (606417) | more than 11 years ago | (#5242614)

I take it you mean STL strings? Apart from those, I cannot imagine what you mean by standard C++ strings.

I suppose he means std::string as defined in the C++ Standard ISO/IEC 14882:1998

If that is what you mean, I have to point out that STL strings are no more 'standard' than the null terminated variety.

NUL-terminated strings are also Standard C++

From the review I would hazard a guess that the book makes no reference to the Standard Template Library

Neither does the standard. STL has been assimilated.

What a waste of screen space (0)

Anonymous Coward | more than 11 years ago | (#5242515)

What is the point in publishing this "review"?
It does not provide any useful information about
the book contents. It does not try to argue about
book's strong and weak points on the basis of its
content either. All it says is "This book talks
about Visual C++ and doesn't talk about STL. I
do not like Visual C++ and like STL, so the book
sucks because it doesn't mention my favorite things."

If you call it a "review", I wonder what you call "news"...

worst book review ever (3, Interesting)

NixterAg (198468) | more than 11 years ago | (#5242617)

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.
Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Sign up for Slashdot Newsletters
Create a Slashdot Account

Loading...