Slashdot Mirror


Mike and Phani's Essential C++ Techniques

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.

195 comments

  1. although by REBloomfield · · Score: 3, Insightful

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

    1. Re:although by Anonymous Coward · · Score: 0

      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.

    2. Re:although by Anonymous Coward · · Score: 0

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

    3. Re:although by Anonymous Coward · · Score: 0

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

    4. Re:although by yamla · · Score: 1

      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.

      --

      Oceania has always been at war with Eastasia.
    5. Re:although by Anonymous Coward · · Score: 0

      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.

    6. Re:although by Jeff+Binder · · Score: 1
      There are a lot of companies still using VS C++ 6.0, and alot don't want to upgrade.
      I think the point was not that the book was aimed at an older compiler, but that it was aimed specificly at Microsoft's compilers. This means that at least some of the tricks in the book wouldn't work in other compilers, such as GCC, CodeWarrior, etc., and the only compiler they would work in is Windows only. So the tricks are useless in portable code.
    7. Re:although by Anonymous Coward · · Score: 0

      And don't forget, a specific version of a specific vendor's specific compiler. Bleh.

  2. Difference between MS and ANSI? by gpinzone · · Score: 1

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

    1. Re:Difference between MS and ANSI? by stratjakt · · Score: 2, Insightful

      Nothing with the language itself.

      I assume that the examples use windows-specific libraries and stuff. Like MFC and COM stuff. Or maybe it just discusses the location of various options in the VStudio IDE.

      If the book had anything insightful to offer, it really wouldnt matter what flavor implementation the examples are in. I have a really great OpenGL book, for instance, thats full of X-Windows specific examples (like creating and maintaining viewports, etc). Being able to take the ideas to windows is no big thing (cant think of the title of it).

      If the book sucks then it sucks because it has nothing to say, not because it uses VC++ as an example. If being VC++ -centric is the only basis for saying it sucks, then the reviewer sucks.

      --
      I don't need no instructions to know how to rock!!!!
    2. Re:Difference between MS and ANSI? by Viking+Coder · · Score: 5, Informative
      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.
      --
      Education is the silver bullet.
    3. Re:Difference between MS and ANSI? by j_kenpo · · Score: 1

      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.

    4. Re:Difference between MS and ANSI? by alefbet · · Score: 5, Informative
      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.
      --

      A hack is just an idiom waiting for wider use.
    5. Re:Difference between MS and ANSI? by Lazar+Dobrescu · · Score: 1

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

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

    6. Re:Difference between MS and ANSI? by yamla · · Score: 4, Interesting

      I did try to point out that the book was bad even for Visual C++ programmers. It uses old-style C++ (#include , for example), ignores valuable contributions to C++ such as the STL and the standard string class, and generally provides nothing a decent C++ programmer should not already know.

      It isn't so much that the examples are targetted for Visual C++ 6.0, it is that the techniques themselves are. It is no good telling me, 'If you set eax from assembly, disable warning 4035' unless I am using Visual C++ on an ix86-compatible processor. It just doesn't translate to any other platform.

      --

      Oceania has always been at war with Eastasia.
    7. Re:Difference between MS and ANSI? by Anonymous Coward · · Score: 0

      Both of your examples are simply not true for vc7.

    8. Re:Difference between MS and ANSI? by spectecjr · · Score: 1, Informative

      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

      --
      Coming soon - pyrogyra
    9. Re:Difference between MS and ANSI? by hackstraw · · Score: 1
      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++.
    10. Re:Difference between MS and ANSI? by Gortbusters.org · · Score: 2, Interesting

      When I took an object oriented course a couple semesters ago, it used C++. I started out the course using gcc-2.96 on Redhat 7.3. Unfortunately, the teaching assitant was using MS visual studio 6. There were no compiler stipulations in the syllabus for the course either.. by the time the first project got graded, there was a ton of confusion.

      0 compile errors on gcc, and like 50 in VS. I found out that where Linux let me to declare the std namespace in the main file where I had all my includes, VS wanted the namespace declared in every file to use anything from the STL. There was also other little stuff, but nothing tooo bad.

      I couldn't spend all semester like this, so I picked up a copy of VS. After using it for the rest of the semester, my conclusion was: bleh. It was okay, but nothing to write home about and I missed the command line tools.

      --
      --------
      Free your mind.
    11. Re:Difference between MS and ANSI? by Dionysus · · Score: 1

      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)

      --
      Je ne parle pas francais.
    12. Re:Difference between MS and ANSI? by Anonymous Coward · · Score: 0

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

    13. Re:Difference between MS and ANSI? by Anonymous Coward · · Score: 0
      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_;
      };
    14. Re:Difference between MS and ANSI? by kaphka · · Score: 1
      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. (Look for "-fhonor-std".)
      --

      MSK

    15. Re:Difference between MS and ANSI? by Dr.+Photo · · Score: 1
      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.

    16. Re:Difference between MS and ANSI? by Curien · · Score: 1

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

      --
      It's always a long day... 86400 doesn't fit into a short.
    17. Re:Difference between MS and ANSI? by Anonymous Coward · · Score: 0

      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){}

    18. Re:Difference between MS and ANSI? by oliverthered · · Score: 2

      string thing.
      the string tempaltes are good, but sloooowww as hell.
      If you were taught C++ like peeps are taught Java and you've been using std::string in a was that copyies and allocates data all the time then being shown how to use \0 strings will improve you codes memory and speed preformance.

      I know people who do C++ 'programming' but wouldn't know how to use structs and function pointers in C to make 'classes'.

      --
      thank God the internet isn't a human right.
    19. Re:Difference between MS and ANSI? by Antity · · Score: 2, Informative
      Title: Mike and Phani's Essential C++ Techniques
      Authors: Michael Hyman and Phani Vaddadi
      Publisher: APress
      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.

      --
      42. Easy. What is 32 + 8 + 2?
    20. Re:Difference between MS and ANSI? by IonSwitz · · Score: 1

      The template thing works in MSVC++ 6.0, so
      I'm glad that your post got modded up to 5 Informative. ;-)

      Something that DOESN'T work in MSVC++ 6.0 is
      partial template specializations, but it's
      alledgedly in the .NET compiler.

    21. Re:Difference between MS and ANSI? by rabidcow · · Score: 1

      It compiles with Microsoft extensions enabled by default, if you tell it to be ANSI compliant, it gets for-loop scope right. (templates still give it trouble in some cases, but to be fair they've been difficult for all compiler writers to get right)

    22. Re:Difference between MS and ANSI? by Anonymous Coward · · Score: 0

      WTF? /. ate my link? Since when does POT strip HTML tags? Well thanks a lot for making my post a lot less meaningful.

    23. Re:Difference between MS and ANSI? by orthogonal · · Score: 1

      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.

    24. Re:Difference between MS and ANSI? by dustman · · Score: 3, Informative

      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)

    25. Re:Difference between MS and ANSI? by Kupek · · Score: 1
      This is not true. On page 264 of Stroustrup, third edition, he has this code:
      class X {
      private:
      void operator=(const X&);
      void operator&();
      void operator,(const X&);
      }
      The point of this code is to demonstrate how to make it illegal for someone to use these operators on an object of type X.
    26. Re:Difference between MS and ANSI? by orthogonal · · Score: 1
      this is WRONG! operator=() MUST return a reference to the object instance

      As long as we're pretending this is comp.lang.c++.moderated, while I agree that any op= should return *this, I didn't think the Standard required it.

      As my copy of the Standard is at home, and I'm not, could you quote chapter & verse?

      For what it's worth, comeau's online compiler passes the following:

      class foo {
      void operator=( int a ) {
      }
      } ;

    27. Re:Difference between MS and ANSI? by batand · · Score: 1

      With ATL 3.0, MS introduced "import" (sort of like include). Also some special pseudo-template stuff to provide better smart-pointers was introduced. This was in VS 6.0.

      I don't know, if the book uses this stuff, though.

    28. Re:Difference between MS and ANSI? by Curien · · Score: 1

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

      --
      It's always a long day... 86400 doesn't fit into a short.
    29. Re:Difference between MS and ANSI? by arkanes · · Score: 1

      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.

    30. Re:Difference between MS and ANSI? by arkanes · · Score: 1
      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.

    31. Re:Difference between MS and ANSI? by yamla · · Score: 1

      Visual C++ 6.0 supports C++-style strings, supports (badly) the STL, and can use the modern #include syntax.

      --

      Oceania has always been at war with Eastasia.
    32. Re:Difference between MS and ANSI? by Curien · · Score: 1

      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?

      --
      It's always a long day... 86400 doesn't fit into a short.
    33. Re:Difference between MS and ANSI? by Viking+Coder · · Score: 1

      You're right. I should have put the function in a class. You can't get there from here with MSVC++ 6.0.

      --
      Education is the silver bullet.
    34. Re:Difference between MS and ANSI? by arkanes · · Score: 1

      You know that extensions are part of the C++ standard, right?

    35. Re:Difference between MS and ANSI? by Anonymous+Brave+Guy · · Score: 1
      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...

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    36. Re:Difference between MS and ANSI? by Bert+Peers · · Score: 1

      * 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 :)

    37. Re:Difference between MS and ANSI? by Curien · · Score: 1

      No, they're not. It *allows* for extensions, but any extension is not, by definition, part of the language.

      --
      It's always a long day... 86400 doesn't fit into a short.
    38. Re:Difference between MS and ANSI? by schmaltz · · Score: 1

      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.

      --
      Big Daddy, Johnny, Burp, Aunt Zelda, Scott, Slurp, Big Momma ... where's Siggy?
    39. Re:Difference between MS and ANSI? by Anonymous Coward · · Score: 0

      Uhm, for scalar types, it's a non-issue. The code generated is identical. For objects w/ a constructor/destructor, you're only calling the constructor once and desctructor once.

    40. Re:Difference between MS and ANSI? by harlows_monkeys · · Score: 1
      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.

    41. Re:Difference between MS and ANSI? by alefbet · · Score: 1
      stdafx.h

      #define for if (0) ; else for

      weeee :)
      I've debated this workaround for a long time and it always scared me off. Aside from the minor fear stemming from the statement in the C++ standard saying that #define'ing keywords invokes undefined behavior, and the fear that this could cause different token sequences for class definitions in different translation units which also invokes undefined behavior, I've always been afraid that if this #define found its way above the inclusion of a standard header that it would break the template implementations in the header files, just like the compiler switch does.

      It's also more difficult to port code that uses precompiled headers, since that is a Visual C++ extension. (I'm not saying that precompiled headers are bad, just nonportable.)
      --

      A hack is just an idiom waiting for wider use.
    42. Re:Difference between MS and ANSI? by Anonymous Coward · · Score: 0

      Koenig lookup is a GoodThing(tm) especially for named functions. The VC++ 6 compiler was and still is an abomination considering that it's basically VC++ 5 with GUI enhancements, many of which behave badly for large projects. Remember VC++ 6 came out after the standard was adopted and M$ was on the standards committee. Of all the compilers I need to use on a daily basis, VC++ 6 is the absolute worst. The best advice I can give any beginning programmer is to learn Standard C++ first, then learn windows programming if you're still interested.

    43. Re:Difference between MS and ANSI? by oliverthered · · Score: 1

      well, I got 10x performance increase changing some std::strings to /0 strings, with borlands STL and the STL that comes with GCC.

      I susspect the performance gains were because of the extra overheard of creating objects, extra redirection and abstration.

      --
      thank God the internet isn't a human right.
    44. Re:Difference between MS and ANSI? by Dr.+Photo · · Score: 1
      Uhm, for scalar types, it's a non-issue. The code generated is identical. For objects w/ a constructor/destructor, you're only calling the constructor once and desctructor once.


      That's not how gcc does it. Is this an MSVC-specific misfeature, or can you quote chapter-and-verse (Stroustrup or the ISO standard will do) to show that gcc does it wrong?


      Observe:

      #include <iostream>

      using namespace std;

      class Foo {
      public:
      bool operator< (int x) { return (i < x); }
      Foo(int i_, const char* str) { i = i_; cerr << str << i << endl; }
      int operator() () { return i; }
      int operator++ (int) { return i++; }
      ~Foo() { cerr << "~Foo()\n"; }

      private:
      int i;
      };

      int main()
      {
      for(Foo a(0, "Constructor for `a' called: "); a < 4; a++) {
      cout << "a is " << a() << endl;
      for(Foo b(12, "Constructor for `b' called: "); b < 17; b++) {
      cout << "b is " << b() << endl;
      }
      }

      return 0;
      }


      $ g++ -Wall -W -ansi -pedantic -o foo foo.cc

      $ ./foo


      I'll post the output below in a minute, since the lameness filter is its own worst enemy...

    45. Re:Difference between MS and ANSI? by Dr.+Photo · · Score: 1
      (Continued from above)
      Constructor for `a' called: 0
      a is 0
      Constructor for `b' called: 12
      b is 12
      b is 13
      b is 14
      b is 15
      b is 16
      ~Foo()
      a is 1
      Constructor for `b' called: 12
      b is 12
      b is 13
      b is 14
      b is 15
      b is 16
      ~Foo()
      a is 2
      Constructor for `b' called: 12
      b is 12
      b is 13
      b is 14
      b is 15
      b is 16
      ~Foo()
      a is 3
      Constructor for `b' called: 12
      b is 12
      b is 13
      b is 14
      b is 15
      b is 16
      ~Foo()
      ~Foo()
    46. Re:Difference between MS and ANSI? by pyrrho · · Score: 1

      yes, as of MSVC 6.0 you still cannot have templatized members. I wondered if that's what you meant as I couldn't imagine the function by itself not working....

      --

      -pyrrho

    47. Re:Difference between MS and ANSI? by arkanes · · Score: 1

      Right, that's code bloat, not performance bloat.

    48. Re:Difference between MS and ANSI? by arkanes · · Score: 1
      That's a pretty huge increase, although I'm not familiar with either of those STL implementations - I use STLport, generally, or MS's one when I don't want to distribute the STL port DLLs.

      That said, I can see that for certain cases, although you probably could have gotten most of the same increase by re-working your code instead of switching to C style strings. But whatever works ;)

  3. Mmmm. Tasty O'Reilly... by alaric187 · · Score: 1

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

  4. Bright Spots? by Sebastopol · · Score: 0, Redundant

    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.

    --
    https://www.accountkiller.com/removal-requested
    1. Re:Bright Spots? by yamla · · Score: 3, Informative

      I reviewed it because maybe I could help stop other people from buying the book. I absolutely agree that Scott Meyers's books are excellent. I wish he'd write one on templates and generic programming but Modern C++ Design by Andrei Alexandrescu (with a foreward by Meyers) is good enough for me.

      --

      Oceania has always been at war with Eastasia.
    2. Re:Bright Spots? by phurley · · Score: 1
      I have to agree that Modern C++ Design is an excellent book -- better than "Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library", but Meyers' book is still worth mentioning.

      --
      Home Automation & Linux -- now I know I'm a geek
    3. Re:Bright Spots? by krlynch · · Score: 1

      Try C++ Templates by Josuttis and Vandevoorde. Good stuff.

    4. Re:Bright Spots? by renehollan · · Score: 1
      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.

      --
      You could've hired me.
    5. Re:Bright Spots? by johnnyb · · Score: 1

      Actually, reading the book made me wish for (defmacro)

    6. Re:Bright Spots? by renehollan · · Score: 1
      Actually, reading the book made me wish for (defmacro)

      Well, duh! Nothing other than copious parenthesis will satisfy a Lithper so far gone as ye :-)

      --
      You could've hired me.
  5. heh by hfastedge · · Score: 0, Troll

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

    --

    -- -- --

    Help my mini cause: My journal

  6. More specifics on VC focus by binaryDigit · · Score: 4, Insightful

    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.

    1. Re:More specifics on VC focus by koh · · Score: 2, Informative

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

      --
      Karma cannot be described by words alone.
    2. Re:More specifics on VC focus by yamla · · Score: 4, Informative

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

      --

      Oceania has always been at war with Eastasia.
  7. Bad for most peoples by Achmed+Swaribabu · · Score: 1
    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.

    --

    All the best,
    --Achmed

    Swaribabu Consulting Inc. -- We code so you don't have to

  8. Advanced Visual Studio C++? by gammoth · · Score: 1, Flamebait

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

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

    1. Re:Advanced Visual Studio C++? by spectecjr · · Score: 1

      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

      --
      Coming soon - pyrogyra
    2. Re:Advanced Visual Studio C++? by Anonymous Coward · · Score: 0

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

      Such as ...?

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

    3. Re:Advanced Visual Studio C++? by The+Bungi · · Score: 0, Offtopic
      OMFG!!! J00 r z0 1337!!1!!

      That's why I come to Slashdot, to hear 14-year olds "tell it like it is".

      Keep it up!

  9. Scott Meyers by j_kenpo · · Score: 3, Interesting

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

    1. Re:Scott Meyers by Anonymous Coward · · Score: 0

      For reference: Stroustrupp(obviously) The C++ Programming Language; Lippman and Lajoie's C++ primer; Josuttis, or Austern's STL book; and(again obviously) ANSI/ISO/IEC 14882. There are a number of other good books covering specific C++ topics not covered by the standard references mentioned above. Some of these are: Effective C++, and More Effective C++ by Meyers; Standard C++ IOStreams and Locales by Langer and Kreft; Exceptional C++ and More Exceptional C++ by Herb Sutter; Modern C++ Design by Alexandrescu which gives your template knowledge a thorough workout along with C++ Templates: The Complete Guide by Jossutis and Vandevoorde. You can look at www.accu.org and check out the books that are "highly reccomended" there. I think all of the ones I listed are among them. Other references woth noting are C/C++ user's journal which has a number of articles online. If you want to see where standard C++ is going you can keep tabs on the standards working group at http://anubis.dkuug.dk/jtc1/sc22/wg21/

    2. Re:Scott Meyers by whitehorse · · Score: 1

      Mod Parent up! I have a well read copy of Effective C++ sitting within arms reach of my desk. Many projects have benefited from this book, I have team members who have "seen the light" due to Meyers thoughtful reasoning for his tips. Read effective C++, it is the best C++ tip book out there, it will save you days of debugging time in the long run.

    3. Re:Scott Meyers by monadicIO · · Score: 1

      particularly Effective C++ and More Effective C++.
      So "Effective C++" was really "LESS Effective C++", that a "MORE Effective C++" needed to be written? I'm eagerly awaiting "Much More Effective C++", "Even More Effective C++" and "Infinitely More Effective C++". Hopefully, we'll also have "Chicken soup for the C++ programmer", "C programmers are from Uranus, C++ programmers are from Mercury", etc..

      --

      The law of excluded middle : Either I'm foo or I'm foobar

    4. Re: Scott Meyers by Antity · · Score: 1

      So "Effective C++" was really "LESS Effective C++", that a "MORE Effective C++" needed to be written?

      On some systems, more is already less.

      --
      42. Easy. What is 32 + 8 + 2?
    5. Re:Scott Meyers by pyrrho · · Score: 1

      uhoh... I've been using it as advice on effective obfucation techniques!!! doh!

      --

      -pyrrho

  10. Kickasso reviews 99.99% of all C++ books at once! by Kickasso · · Score: 4, Informative
    They are crap.

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

  11. Dudes.... by Anonymous Coward · · Score: 0

    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

  12. Not so great by Rossalina+W+Sanchez · · Score: 0, Informative

    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.

    --

    --Rosie

    1. Re:Not so great by Anonymous Coward · · Score: 1, Informative

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

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

    2. Re:Not so great by orthogonal · · Score: 1

      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?

    3. Re:Not so great by yamla · · Score: 1

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

      Oceania has always been at war with Eastasia.
    4. Re:Not so great by mccalli · · Score: 1
      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

    5. Re:Not so great by e-Motion · · Score: 1

      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.

    6. Re:Not so great by Euphonious+Coward · · Score: 2, Informative
      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.

    7. Re:Not so great by Anonymous Coward · · Score: 0

      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.

    8. Re:Not so great by Anonymous Coward · · Score: 0

      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.

    9. Re:Not so great by Anonymous Coward · · Score: 0

      Avoiding the CRT (C runtime) is a valid technique when programming for Windows. You either bloat your working set by statically linking with the CRT, or you link with it dynamically and then you have to install the CRT DLLs along with your application, opening yourself up to potential DLL conflicts. This is fine if you're doing an in-house app where you control the runtime environment, but if you need the app to run on Win9x and Windows 2000/Windows XP, it's best to avoid the problems altogether. Avoiding the CRT keeps code lean and mean.

      Also, remember that this book was published more than 3 years ago, practically a life-time in this industry. Things change.

  13. Pot-kettle scenario by pongo000 · · Score: 2, Insightful

    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.

    1. Re:Pot-kettle scenario by Anonymous Coward · · Score: 0

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

      Ps. C++ is shit!!

    2. Re:Pot-kettle scenario by Anonymous Coward · · Score: 0

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

    3. Re:Pot-kettle scenario by yamla · · Score: 2, Informative

      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?

      --

      Oceania has always been at war with Eastasia.
    4. Re:Pot-kettle scenario by dvdeug · · Score: 1

      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.

    5. Re:Pot-kettle scenario by Hortensia+Patel · · Score: 3, Informative

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

    6. Re:Pot-kettle scenario by olethrosdc · · Score: 1

      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?

      --

      I miss my rubber keyboard.(Homepage)

    7. Re:Pot-kettle scenario by Anonymous Coward · · Score: 0

      You are an ignorant twat. Your earth shattering revelation that very few C++ compilers are compliant is obvious, well known, and completely irrelevant. The point is that the book is marketed towards C++, when it's content is directed towards VC++ 6.0. This is a massively important fact to point out. Oh, and good C++ programmers know exactly why null-terminated strings and printf suck so much, which is why good C++ programmers wrote the string class, and iostream classes in the first place.

    8. Re: Pot-kettle scenario by Antity · · Score: 1

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

      I'm sure it's not what you wanted to hear, but it's indeed "implemention-dependent". :-) Trying to figure out C++, you'll hear this term a lot.

      --
      42. Easy. What is 32 + 8 + 2?
    9. Re:Pot-kettle scenario by arkanes · · Score: 1

      It's about the same age as VS 6.0, then, but I don't see anyone stopping ragging on it :P

    10. Re: Pot-kettle scenario by olethrosdc · · Score: 1

      yeah, and I guess it makes sense in general to wrap stuff like that in objects so that you can change the implementation more easily. But you can also do that in ANSI C, in at least two ways:

      1) OO-style

      typedef struct String_ {
      void* string; //the method knows the *real* type
      int (*printf) (struct String_* string);
      } String;

      then call
      mystring->printf(mystring);

      2) Function pointers again, but without the Object concept

      typedef StringFunctions_ {
      int (*printf) (void* string);
      } StringFunctions;

      which can then be binded statically or at run-time

      StringFunctions str_null_term = {
      int (*printf_null_term) (void* string);
      };

      3) With MACROS (however, varargs are not permitted)

      --

      I miss my rubber keyboard.(Homepage)

    11. Re:Pot-kettle scenario by dvdeug · · Score: 1
      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.
  14. This review only got posted because it was anit-MS by Anonymous Coward · · Score: 0

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

  15. Weak book? by Malc · · Score: 1

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

    1. Re:Weak book? by Anonymous Coward · · Score: 0

      Except for the dreaded warning 4786, of course. That is the one saying "a debug symbol is too long", and is generated thousands of times whenever you do something (anything at all) with STL.

      Of course you can #pragma it to silence, but (and this is the really annoying bit) sometimes the compiler decides to just ignore that pragma and generate the warning anyway.

      I have to admit I also routinely turn off warning 4800 (conversion to bool) which it emits whenever you do if ()...

    2. Re:Weak book? by Malc · · Score: 1

      I put the pragma for the truncation of STL debug symbols in the precompiled header. I also put all of the STL headers I use in that file too, as this seems the most effective way to avoid that really really annoying warning. In fact, I'm so paranoid about it, that I ensure any STL headers I include elsewhere are included in the same order (although I think this makes no difference in MSVC, and maybe just a throwback to my Borland C++ days).

      As for the if statements, I also do explicit comparisons even if the variable is a bool as this makes maintenance easier for others and reduces the chance of a bug slipping (a habit that dates back to before that conversion to bool warning.)

  16. Re:Not so great MOD PARENT UP by Achmed+Swaribabu · · Score: 0, Offtopic
    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.

    --

    All the best,
    --Achmed

    Swaribabu Consulting Inc. -- We code so you don't have to

  17. Plug by nycsubway · · Score: 3, Interesting
    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

    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.

    1. Re:Plug by Anonymous Coward · · Score: 0

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

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

    2. Re:Plug by monadicIO · · Score: 1

      Great. Is is open source?

      --

      The law of excluded middle : Either I'm foo or I'm foobar

    3. Re:Plug by Lodragandraoidh · · Score: 1

      Charge $2 for the laminated version (plus shipping), and give away a free .PDF version so users can roll their own. The good will generated alone will bring in droves of hits to your website, and folks that spill coffee on their paper versions will buy your laminated version as an upgrade.

      $9 is about a third of the cost of a decent book on C++ - you are not providing a third of the value of that - even if it is laminated.

      --

      Lodragan Draoidh
      The more you explain it, the more I don't understand it. - Mark Twain
  18. the for loop thing by oliverthered · · Score: 2, Informative

    SFAIK variable scope is a bit weird in ANSI C,

    for(int i;...){
    }
    i=123;
    is valid ANSI C (for some strange reason)

    for(int i;...){
    j
    }
    j=123;

    is not valid
    {
    for(int i;...){
    }
    }
    i=123;
    is not valid

    the same is true for if and switch

    this is a pain because of reuse.
    for(int i;...){
    }
    for(int i;...){
    }

    is invalid ANSI C because i is still in scope in the second for loop.

    --
    thank God the internet isn't a human right.
    1. Re:the for loop thing by olethrosdc · · Score: 1

      Yes, because the preprocessor does this translation:

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

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

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

      --

      I miss my rubber keyboard.(Homepage)

    2. Re: the for loop thing by Antity · · Score: 1

      Yes, because the preprocessor does this translation:

      Preprocessor? What preprocessor? Microsoft aren't using cfront in VC++, are they?

      --
      42. Easy. What is 32 + 8 + 2?
    3. Re:the for loop thing by Kragg · · Score: 1

      It's not the preprocessor, it's the compiler. And it turns the pattern

      for (x; y; z) {code}

      into

      x; while(y) {code; z;}

      which, as it happens, gives declarations in x a wider scope than intended. Also, I don't think that this is ANSI, this is MS specific. The ANSI alternative is

      {x; while(y) {code; z;}}

      --
      If you can't see this, click here to enable sigs.
    4. Re:the for loop thing by arkanes · · Score: 1

      As I recall, this behavior was unspecified in early versions of the C++ spec, and a number of compilers implemented it the way MS does, because C programmers were used to it working like that. It's non-standard, but pretty common - I believe that VC .NET has an option to toggle the behavior.

    5. Re:the for loop thing by Anonymous Coward · · Score: 0

      Bjarne Stroustrup, our god and master
      specifically states it loses scope in
      "C++ Programming Language, Third Edition"
      which I am lovingly examining.

      Also, see:
      http://std.dkuug.dk/jtc1/sc22/open/n2356/stm t.html

  19. For MSVC development by Timesprout · · Score: 4, Interesting

    If MSVC is your only environment try here for tips and pointers. They cover a lot of other stuff as well. For pure C++ then as others have said go with Myers / Stroustrup etc

    --
    Do not try to read the dupe, thats impossible. Instead, only try to realize the truth
    What truth?
    There is no dupe
  20. Book is from 1999 by 1st1 · · Score: 5, Informative

    It is an old book: September 1999

    --
    NullPointerException
  21. Top 5 reasons to buy a crappy C++ book by Amsterdam+Vallon · · Score: 0, Redundant

    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

    --

    Reply or e-mail; don't vaguely moderate. Ex-O'Reilly/MIT employee, now a full-time Google employee.
    1. Re:Top 5 reasons to buy a crappy C++ book by Anonymous+Brave+Guy · · Score: 1
      3 -- It's the only language left that doesn't try to be "write once, run on any toaster oven"

      And yet, ironically enough, it's one of the few where this is not far from the truth. :-)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  22. Moderator bait - Re:Plug by Malc · · Score: 1

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

  23. GCC 2.9x? by Kickasso · · Score: 1

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

    1. Re:GCC 2.9x? by Anonymous Coward · · Score: 0

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

    2. Re:GCC 2.9x? by Anonymous Coward · · Score: 0

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

  24. To late. by demigod · · Score: 1
    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.

    --
    "The last thing I want to do is deal with a bunch of people who want something."
    Major Major
    1. Re:To late. by yamla · · Score: 1

      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.

      --

      Oceania has always been at war with Eastasia.
    2. Re:To late. by 1st1 · · Score: 1

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

      --
      NullPointerException
  25. Dude. by Kickasso · · Score: 2, Informative

    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.

  26. Fixed in ANSI 96 by Anonymous Coward · · Score: 0

    Basic.Scope.

    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.

  27. Also, the "C++ In Depth" series by devphil · · Score: 1


    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.

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
    1. Re:Also, the "C++ In Depth" series by Canis+Lupus · · Score: 1

      I have several of the books in the this series. I enjoy the advanced topics, yet I am saddened when I realize many of the techniques discussed seem to be yet another way to beat the C++ into submission. (i.e., the books seem to point out the numerous holes in the C++ language and ways to avoid them. Which makes me wonder what can be done to the language itself to address some of those issues...).

      --
      The real silver bullet to good programs is caffeine; lots and lots of caffeine! *twitch, twitch*
    2. Re:Also, the "C++ In Depth" series by devphil · · Score: 1


      Many (if not all) of the authors are also on the ISO C++ committee. So when they observe that the C++98 language has a particular flaw, you can be sure that they're also finding ways to fix it in C++0x.

      --
      You cannot apply a technological solution to a sociological problem. (Edwards' Law)
  28. You mean C++ by kyz · · Score: 1

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

    --
    Does my bum look big in this?
    1. Re:You mean C++ by gid-goo · · Score: 1

      That's no longer true in the C 99 spec.

  29. Were you expecting time-travel? by devphil · · Score: 2
    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.)

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
  30. Compatibility nightmare by iamacat · · Score: 3, Interesting
    .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.

    1. Re:Compatibility nightmare by Anonymous Coward · · Score: 0

      And not to mention different project/workspace config files.

  31. Nitpick by Chocolate+Teapot · · Score: 1
    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.
    --
    Modest doubt is called the beacon of the wise. - William Shakespeare
    1. Re:Nitpick by spakka · · Score: 1

      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.

    2. Re:Nitpick by yamla · · Score: 1

      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.

      --

      Oceania has always been at war with Eastasia.
    3. Re:Nitpick by Anonymous+Brave+Guy · · Score: 1
      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.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  32. What a waste of screen space by Anonymous Coward · · Score: 0

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

  33. What was I thinking ^&%#^%@ by Chocolate+Teapot · · Score: 1
    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.
    --
    Modest doubt is called the beacon of the wise. - William Shakespeare
  34. #define for if (false); else for by iamacat · · Score: 1
    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 :-(

    1. Re:#define for if (false); else for by arkanes · · Score: 1

      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?

  35. lol...MOD PARENT +1 FUNNY by Anonymous Coward · · Score: 0

    rotflmao

  36. worst book review ever by NixterAg · · Score: 3, Interesting

    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.

    1. Re: worst book review ever by Antity · · Score: 1

      And you forgot to mention that the book reviewed is three and a half years old.

      I mean: Review a 3.5 year-old book on C++ and criticize its view of the standard? In 2003?

      --
      42. Easy. What is 32 + 8 + 2?
    2. Re:worst book review ever by yamla · · Score: 1

      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.

      --

      Oceania has always been at war with Eastasia.
    3. Re: worst book review ever by yamla · · Score: 1

      The book is still being sold. I got it last year iirc (it was sent to slashdot looking for a reviewer). There is no mention in the book or on the web site that it doesn't cover the 1998 C++ standard.

      --

      Oceania has always been at war with Eastasia.
    4. Re:worst book review ever by Anonymous Coward · · Score: 0

      Did you read the introduction? 9/10 books include a section about who the book is targetted at. If not you end up with "How to use Java" (small print: "applets") instead of How do Java" (small print: "programming"). And what kind of book store won't let you look at their books (a book store in the mall?) ? I hope you were just making a generalization, I would definitely shop somewhere else.

    5. Re:worst book review ever by yamla · · Score: 1

      Yeap, I read the introduction. No comment in there about being targetted at Visual C++ programmers. No comment in there about being aimed at beginners.

      --

      Oceania has always been at war with Eastasia.
  37. Ditto for CodeProject by Anonymous Coward · · Score: 0

    CodeProject 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

  38. Re:Kickasso reviews 99.99% of all C++ books at onc by monadicIO · · Score: 1

    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.

    --

    The law of excluded middle : Either I'm foo or I'm foobar

  39. Techincal books suck by Anonymous Coward · · Score: 0
    There was a time, just a few years ago, when most of the computer books sucked, but there was still a pretty decent percentage of good to great ones that were worth the money. No longer. The computer book industry was so devastated by their own towering incompetence and the dot-com flameout (which ended a lot of employers-buying-books-for-their-employees stuff), that they're reduced to publishing anything they can think of and hoping something sells.

    I was a writer in the field for a long time, and I dropped out completely to do something else because of how insane the publishers became. I wish I could say I see the situation getting better, but I don't.

  40. MOD PARENT UP by exp(pi*sqrt(163)) · · Score: 1

    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.

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
  41. ACCU.org by ajw1976 · · Score: 1

    The Association of C and C++ users has several reviews for C and C++ books. My favorites are The C++ Standard Library, by Josuttis The C++ Programming Language 3rd ed, Stroustrup I read a lot of good reviews for Accelerated C++; therefore, I have ordered it.

    --
    1. Bad signature
    2. ?????
    3. Profit
    1. Re:ACCU.org by bjforshaw · · Score: 1

      Link to ACCU.

  42. Outrageous by mhackarbie · · Score: 1
    that a book with the claim of 'Essential C++' has no mention of the STL. Many of the components in this standard library are just incredibly useful and can have a huge benefit for larger, more complicated projects.

    I use Visual C++ in my development, but I urge people to bypass such marketing tricks and pick up something really useful, like "The C++ Programming Language", by the man himself, Bjarne Stroustrup. Reading that book completely transformed my programming experience, and every serious C++ programmer should check it out.

    mhack

    --
    Building a better ribosome since 1997
    1. Re:Outrageous by Anonymous Coward · · Score: 0

      Even the standard has no mention of the STL. No really, I just checked it.

    2. Re:Outrageous by mhackarbie · · Score: 1

      Well sure, the standard just applies to the language, which is independent of any libraries. But still, in a practical sense, any book which purports to be about effective C++ should mention the STL.

      --
      Building a better ribosome since 1997
  43. GCC and 'std' namespace by Antity · · Score: 2

    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?

    --
    42. Easy. What is 32 + 8 + 2?
    1. Re:GCC and 'std' namespace by Anonymous Coward · · Score: 0

      ::Perhaps that's because gcc completely ignores the std namespace. :Let's say it did.

      Let's say he was talking about gcc 2.96 in first place.

    2. Re:GCC and 'std' namespace by gkatsi · · Score: 1

      Comeau rejects it as well.

    3. Re:GCC and 'std' namespace by PhilHibbs · · Score: 1
      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.
    4. Re:GCC and 'std' namespace by PhilHibbs · · Score: 1

      Arse, I meant "standalone << operator".

  44. C++ by Anonymous Coward · · Score: 0

    I think the problem is using C++.

    Stick to ANSI C and Java 2.1 You'll be ok

  45. Best C++ techniques book by far!! by Anonymous Coward · · Score: 0

    Effective C++ Second Edition by Scott Meyers . . . no decent, hardworking, c++ coder should be without it!

  46. Alternative recommendations? by Anonymous Coward · · Score: 0

    I'm a Java programmer in the job market. However, most employers look for C++ experience. Do you recommend a book designed to help make the transition from Java to C++?

  47. But 5-6 books are more than enough. by Kickasso · · Score: 1
    You just need to know which ones.

    Oh, and before you tell me "look at my favourite language": I already love it. main = interact $ unlines . reverse . lines looks so nice and clean compared to any C++ offering... until you start measuring execution time, sigh.

  48. Re:Kickasso reviews 99.99% of all C++ books at onc by yamla · · Score: 1

    There is a certain amount of truth to this... the C++ standard is really quite complex. I am stunned when I pick up a book like Modern C++ Design and I find a whole new world of C++ opening up for me.

    However, let's face it... the reason most learning-C++ books are so bad is because the authors really do not have a clue. For example, there's nothing complicated with teaching a programmer how to use C++-style strings rather than (or in addition to) C-style NULL-terminated strings, yet very few books actually bother.

    --

    Oceania has always been at war with Eastasia.
  49. Another thing.. by Anonymous Coward · · Score: 0

    They just can't handle the truth, and most of them are in denial of their own stupidity.

  50. Re:Mmmm. Tasty O'Reilly... by Anonymous Coward · · Score: 1, Interesting

    I think you mean "Practical C++ Programming" by Steve Oualline. And I agree, it's an excellent book, a little preachy on style but I consider that better than teaching no style or inconsistent style.

  51. No wonder this looked familiar by ltkije · · Score: 1
    This book is not completely without redeeming qualities.

    It's been sitting on the shelves of the local Borders Outlet for six months or more, always several in stock, though the price is only $6 or $7. The market speaks...

  52. Re:1999 Difference between MS and ANSI? by Lucas+Membrane · · Score: 1

    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.

  53. cstdio by nicfit · · Score: 1

    cstdio and iostream (vs. their .h "equivalents") is not the M$ way of doing things it's the ANSI way. It's just that it's a lagging feature in many compilers. The difference between stdio.h and cstdio is that the latter declares it's symbols in the std namespace when __cplusplus instead of the global namespace. Works in gcc 3...

    1. Re:cstdio by nicfit · · Score: 1

      haha, that should read "the former", not the "latter". ~. you get it?

  54. no... codeProject by Smallest · · Score: 1

    www.codeproject.com is leaps and bounds better than codeguru.

    -c

    --
    I have discovered a truly remarkable proof which this margin is too small to contain.
  55. Mike and Phanni by book_reader · · Score: 1

    Why did slashdot waste valuable bandwidth reviewing a book from 1999?.Sheesh, that is a lifetime ago and VC++ 6.0 sucked anyway.

    Interestingly enough Msoft hired a whole bunch of C++ gods (like Lippman) and are claiming the next version of VC++ (in April) will be teh most ANSI compliant C++ ever. Weird if true. See

    http://www.ondotnet.com/pub/a/dotnet/2002/11/18/ ev erettcpp.html

  56. My Essential C++ technique: by Anonymous Coward · · Score: 0

    Switch immediately to a non-crap language like Common Lisp. Or hell, even ObjC!

  57. This story came with perfect timing by NumenMaster · · Score: 1

    I'm just returning to programming after a ten year vacation. I'm going to pick C++ since that was my choice in the past. The books I have, as well as checked out from the school library, both are written with VC++ in mind. And they're old school (#include iostream.h for instance). Would QT be a good choice? My interest is developing for open source and linux. What would be a good book to purchase that covers beginner C++ programming in Linux?

    --
    Where's my sock? There it is...