Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming Books Media Microsoft Book Reviews IT Technology

Mike and Phani's Essential C++ Techniques 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.
Mike and Phani's Essential C++ Techniques
author Michael Hyman and Phani Vaddadi
pages 239
publisher APress
rating 2/10
reviewer Chris Thompson
ISBN 1893115046
summary This book is useless to any other than the beginning Visual C++ 6.0 students.

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.

This discussion has been archived. No new comments can be posted.

Mike and Phani's Essential C++ Techniques

Comments Filter:
  • Comment removed (Score:3, Insightful)

    by account_deleted ( 4530225 ) on Thursday February 06, 2003 @11:48AM (#5241620)
    Comment removed based on user account deletion
    • 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.
      • by iamacat ( 583406 ) on Thursday February 06, 2003 @01:09PM (#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.

    • Book is from 1999 (Score:5, Informative)

      by 1st1 ( 578775 ) on Thursday February 06, 2003 @12:21PM (#5241918) Homepage
      It is an old book: September 1999
  • 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++.
    • 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.
      • by yamla ( 136560 ) <chris@@@hypocrite...org> on Thursday February 06, 2003 @12:14PM (#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.

        • 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'.
          • Maybe MSs crappy STL implementation, althought I hear the one in VS .NET is better, but all the string classes I use aren't any slower than C style strings - the extra overhead is code bloat from all the functions you don't use, not speed issues.
            • all the string classes I use aren't any slower than C style strings - the extra overhead is code bloat from all the functions you don't use

              Come again? functions you don't use have zero effect on the functions you *do* use, except in the overall size of the .exe or .dll file, which would affect memory management. But once the app's in memory and running, functions you're not using should have no effect on running code.
        • Title: Mike and Phani's Essential C++ Techniques
          Authors: Michael Hyman and Phani Vaddadi
          Publisher: APress [apress.com]
          Copyright: 1999
          ISBN: 1-893115-04-6
          Pages: 300

          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.

          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.

          • Visual C++ 6.0 supports C++-style strings, supports (badly) the STL, and can use the modern #include syntax.
          • How, exactly, did "standard" C++ look back about 3.5 years ago?!

            Pretty much identical to how it looks now, since the standard was published in '98 and the version that became standard was around in '97.

            What did you expect? Hell, many modern C++ features weren't even implemented by most available compilers in 1999.

            I would hope (not expect, alas) that authors professing to teach C++ would make some vague attempt to do so in a correct and useful way, which this book apparently does not.

            And yes, most decent C++ compilers did have reasonable support for the standard bits 'n' pieces by '99. VC++ 6, for example, though featuring a slightly crippled implementation of the standard library, provides perfectly serviceable implementations of string, vector, <iostream>, etc.

            Speaking as someone who has helped out on beginners' C++ forums for years, I hate books like this. They typically teach C++ as it was 15 years ago, which is bad enough, and they make out that it's still that way, which is even worse. You only have to look at the average slashbot's response to any thread about C++ (how it doesn't feature garbage collection, is littered with buffer overrun vulnerabilities and memory leaks, etc.) to realise how little most people who think they know actually know. Now, guess why that might be...

          • The ANSI/ISO standard was finalized around 1998, wasn't it? Gcc/djgpp had STL in 1998, maybe even 1997 or 1996. There was an STL for the Borland compiler in 1998.
      • > 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).
        • 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.

          VC++ is not a language it is an (seriously broken) implemenation of the C++ language.

          The "features" that you mention aren't features as such at all.

          declspec is an instruction to the compiler as to what sort of linkage the linker expects, and entirely implemenatation and OS dependent.

          __int64 is also an implementation issue; it's a typedef for whatever the particular implementation uses to represent 64 bit integral types. Like declspec, it's meaningless on another implementation or OS or machine architecture.

          Functions that start with underscores (like any identifier that starts with an underscore) are according to the standard, "reserved to the implementation"; by definition they're not portable or part of the language per se (even if they exist to implement things specified in the Standard).

          The point is, these aren't features; these things are "glue" to attach the language standard to the implementation/OS/machine, or conveneiences. These things aren't in the language because they don't make sense as part of the Standard.
          • The VC++ compiler implements a language that *is not* C++. Because there is no easy way to refer to this language ("the language compiled by the VC++ compiler"), simply saying "the VC++ language" is suitably descriptive short-hand.

            Yes, you're correct that those features (and they are features -- look up the definition of that word yourself) I mentioned (__int64, extra functions, etc) do not make VC++ /incompatible/ with C++ (though there are some that do), they are, none the less, *not part of C++*.
            • What the hell are you smoking? Like the first responder said, those are platform dependent implementation details. They have nothing to do with C++. GCC and every other compiler has a similar set of extensions. A compiler that didn't have them wouldn't be able to compile code that ran on any modern operating system.

              VC++ having them has NOTHING to do with the compiler (they actuall aren't compiler features, they're pre-processor and linker features) and it's implementation of C++. If you're going to say that the VC++ compiler (cl.exe) doesn't implement C++, then you need to either a) give examples of mandatory parts of the language it fails to implement or b) give examples of parts of the language it implements incorrectly. I'm not saying these don't exist. But muttering about declspec doesn't make a damn bit of sense.

              • What am *I* smoking? Dude... I'm the one saying they have nothing to do with C++. A compiler that has extensions is fine. But those extensions are part of the *compiler*'s *proprietary* language, not the standard C++ language.

                I said that the language implemented by cl.exe is not C++. Even if there weren't conformancy issues (export, templates, main-return-value, the list goes on), then it would be a SUPERSET of C++. As in, JUST BECAUSE IT WORKS IN VC++ DOESN'T MAKE IT C++. Jeez... can you people read?
    • by Viking Coder ( 102287 ) on Thursday February 06, 2003 @12:06PM (#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.
      • 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.

        • you can only declare variables at the start of a block in C, eg for(...){int i;...} or {int i; for(...){...}}
      • 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
      • 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++.
      • 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.
        • 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)
        • 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".)
          • Perhaps that's because gcc completely ignores the std namespace.

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

            #include <iostream>
            #include <string>
            #include <algorithm>
            #include <iterator>
            #include <map>
            #include <cstdlib>

            //namespace std {
            ..std::ostream&
            ..operator<< (std::ostream& ostr, const std::pair<std::string,int>& mypair) {
            ....return ostr << mypair.first;
            ..}
            //};

            int
            main (void) {
            ..std::map<std::string,int> mymap;
            ..mymap[std::string("myid1")] = 1;

            ..std::copy (mymap.begin (), mymap.end (),
            ....std::ostream_iterator<std::pair<std::stri ng,int> >
            ....(std::cout, " "));

            ..return EXIT_SUCCESS;
            }

            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?

            • I mean: Polluting std namespace because of this?
              I thought this was a little odd when I first came across it, but you aren't actually adding any identifiers to the namespace. You're just providing an additional overload for an existing function (the standalone operator). Given that the standalone operator is in namespace std, it makes sense to put overloads in it. Name resolution would be much more complex and unpredictable otherwise.
      • 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 :-(

        • Theres a couple alternate compilers that work just by replacing cl.exe - turbo-something or other is one, it's marketed to game developers because it apparently has excellent speed optimization. Perhaps the Intel one could work the same way?
      • 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)
      • The scope thing is because the proposed standard went back and forth on that several times. Microsoft happened to base VC++ on a pre-final version of the standard that said the scope is not limited to the for loop.

        For (no pun intended) any C++ code I write that I'm not sure will only be used on systems that follow the final standard, I use this little trick I found on usenet:

        #define for if(false);else for

        That makes for loops behave like the standard says, regardless of what scope rules the compiler follows.

    • 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.
    • by alefbet ( 518838 ) on Thursday February 06, 2003 @12:08PM (#5241783) Homepage
      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.
      • * 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.)

        stdafx.h

        #define for if (0) ; else for

        weeee :)
  • 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".
  • by binaryDigit ( 557647 ) on Thursday February 06, 2003 @11:53AM (#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.
    • 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".

    • by yamla ( 136560 ) <chris@@@hypocrite...org> on Thursday February 06, 2003 @12:08PM (#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++.

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

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

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

    • 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
  • Scott Meyers (Score:4, Interesting)

    by j_kenpo ( 571930 ) on Thursday February 06, 2003 @12:01PM (#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).

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

  • by Kickasso ( 210195 ) on Thursday February 06, 2003 @12:03PM (#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.

  • by pongo000 ( 97357 ) on Thursday February 06, 2003 @12:12PM (#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.
    • That's soooo last century. Try 3.2, or something.
    • by yamla ( 136560 )

      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?

    • 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.
      • It's about the same age as VS 6.0, then, but I don't see anyone stopping ragging on it :P
        • It's about the same age as VS 6.0, then, but I don't see anyone stopping ragging on it :P

          You mean imacat writing


          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.


          talking about VC++.NET, or antity's response of

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

          In any case, who cares what people are ragging on? The complaining about GCC 2.95's standard compliance is absurd, whether or not any other complaints are absurd.
    • > 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.
      • 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?

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

  • "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 (Score:3, Interesting)

    by nycsubway ( 79012 ) on Thursday February 06, 2003 @12:17PM (#5241878) Homepage
    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.

    • 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 ;)
    • Dude. (Score:2, Informative)

      by Kickasso ( 210195 )
      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 (Score:4, Interesting)

    by Timesprout ( 579035 ) on Thursday February 06, 2003 @12:21PM (#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
  • 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]

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

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

    • My understanding (and I could well be wrong on this...) is that C++-style strings are included as part of the Standard C++ Library, not as part of the Standard Template Library. The standard library contains the STL but not the other way around.
      • My understanding (and I could well be wrong on this...) is that C++-style strings are included as part of the Standard C++ Library, not as part of the Standard Template Library. The standard library contains the STL but not the other way around.

        More or less. If you want the actual story, do a search for Stepanov, but basically the STL as a concept was invented completely independently of C++, it happened that C++ was the first decent language they found to implement those concepts, and given the match and some advocacy by a few C++ notables, much of the standard C++ library is based on the ideas of the STL.

  • by NixterAg ( 198468 ) on Thursday February 06, 2003 @01:19PM (#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.
    • This is truly an awful review. I wouldn't grace it with the word 'review'. It's pretty well content free. I have no feel whatsoever for what kind of book this is except that it has some stuff about C++ in it. The 'reviewer' is pissed off that the book didn't say some things that they wanted and so wrote a rant about it. This is completely irrelevant to the rest of us.
    • It could well be the worst book review ever. I hope not, but hey, everyone's intitled to their opinion.

      I will point out, however, that I use Visual C++ every day. I have no particular problems with Visual C++ (well, I'd like partial template specialisation but hey). However, I'll remind you, as I pointed out in my review, even examining the index and the introduction of this book does not tell you this is targetted only at Visual C++ 6.0 programmers. Many book stores won't let you read 20 or 30 pages before you buy it.

      Furthermore, even for the book's real targetted audience (Visual C++ 6.0 beginning programmers), the book is bad. The book lists numerous code samples which are simply bad programming style. I mention this in the review as well.

      Yes, I was annoyed that the book mislead (my initial choice of words was much harsher) its purchasers about the real target audience. But the book itself is still really bad even ignoring this significant flaw.

How many hardware guys does it take to change a light bulb? "Well the diagnostics say it's fine buddy, so it's a software problem."

Working...