Slashdot Mirror


Practical C++

jsight writes with his review of Rob McGregor's Practical C++, published by QUE. He writes "Some books attempt to do one thing really well, and others attempt a little of everything. This book is clearly an example of the latter, in full force. Weighing in at a hefty 900 pages, you would expect this book to be crammed with chapters and details on every aspect of the STL and basic C++. In the following review, I am going to cover where it succeeds in doing this, and where it fails." (This book has been out for a few years; what books would make more sense today for a C++ learner's library?) Practical C++ author Rob McGregor pages 900 publisher QUE rating 7/10 reviewer Jess Sightler ISBN 0789721449 summary Provides a practical guidebook to learning C++ Section I -- Programming 101 At first glance, the book appears to be written for people with experience programming, however reading through this section clearly dispels that myth. Here we have a section which goes over everything from for loops to if conditionals while simultaneously using verbose, duplicitous language at every step. Perhaps this was intended as a means of reinforcement, however, it seems most of the effort here would be wasted.

The technical depth is what you would expect for a novice, but without enough hand-holding and examples to make a novice feel comfortable. Making matters worse, there are numerous typos in this section, including quite a few in the examples (making them uncompilable without corrections). Some of these appear to be type-setting errors, however, there are enough to potentially confuse novice developers.

I believe that the combination of weak examples, and significant typographical errors are strong enough to give a novice much difficulty in learning the C++ language.

Having said that, the section should be provide no difficulty for any programmer with a good knowledge of any vaguely similar language (eg, Perl, Java, PHP, etc).

Section II -- Beyond the Basics

Ah, now we're getting down to Brass Tacks... this section goes over everything from Function overloading to Structure and Unions. The section on function members within structures also does an excellent job of preparing the reader for the upcoming introduction of Object Oriented concepts.

The sections on Memory management, both from an allocation standpoint, and from a bit manipulation standpoint are first-rate. Details are perhaps not as strong as they could have been, however the material is very accessible, and clearly described.

Probably my only complaint with this chapter is the overly general section on compiling and debugging programs. However, as this book does attempt to be somewhat compiler/debugger agnostic, this is forgivable. From here, we dive into the real power of C++, Object Orientation.

Section III

From the beginning, this book treats Objects as an extension of the structure syntax taught previously (with the default of Public switched to Private). This, along with the classic Plans vs. Product description of the difference between a Class and an Object are quite clear and robust.

Again, this is a solid chapter, describing the details of getting a system of classes up and running, as well as some sample data structure implementations.

And then finally, the last section is a slightly less than 200 page description of the STL. This section is probably the book's weakest part, as it is just strong enough to give you a taste of what is available, but often not strong enough to grasp the details. It's a good start, but much more attention should have been made to this subject (potentially even at the cost of some of the wasted words on how a 'for' loop works). It makes a decent introduction for someone with very limited STL background, however, there is not enough depth to reach a strong level of understanding here.

Summary Overall, this is a solid book for an existing programmer to pick up C++ concepts. A programmer with a strong knowledge of an existing procedural language (such as C) would have no trouble digesting the concepts of this book. Having said that, the poor typographical issues, and verbose wording often muddle an otherwise good book.

You can purchase Practical C++ from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

64 of 307 comments (clear)

  1. "Practical C++" by alexborges · · Score: 2, Funny

    Now THATS an oxymoron...

    Its the only language that ive had trouble getting

    cout "Hello World!";
    (or equivalent)

    to compile.

    --
    NO SIG
    1. Re:"Practical C++" by BoomerSooner · · Score: 2, Insightful

      Lol

      cout "Hello World!";

      Thanks for the laugh.

    2. Re:"Practical C++" by Anonymous Coward · · Score: 5, Funny

      And your mother too

      My mother is in fact a software developer and has no problems getting a "Hello World" to compile.

    3. Re:"Practical C++" by Anonymous Coward · · Score: 2, Funny

      class omgwtflol {

      public static void main ( String args [] ) {

      System.out.println("omg i hate teh java!!1");

      }
      }

    4. Re:"Practical C++" by Chris_Jefferson · · Score: 2

      actually the standard specifies that the cstdio-type headers put the functions into the std namespace :)

      #include
      using namespace std;
      int main()
      {
      printf("Hello world!\n");
      }

      (yes, the standard does allow you to leave out the return value from main. it will automagically put in a return 0;)

      --
      Combination - fun iPhone puzzling
    5. Re:"Practical C++" by Erratio · · Score: 2, Insightful

      It's probably details like that that are better off forgotten anyway. As time consuming as that line is to type in, if anything it makes the code a little more logical at a glance and considering the quirks specific to all the C based languages, I'd say stuff like that should be left in for legibility. That way more time can be spent by anyone dealing with code worrying about things that actually affect the working of the program.

      --
      I don't try to be right, I just try to make people think
    6. Re:"Practical C++" by X · · Score: 2, Informative
      More like:
      #include <iostream>

      int main()
      {
      std::cout << "Hello World!" << std::endl;
      }
      --
      sigs are a waste of space
  2. out of stock? by fjordboy · · Score: 4, Informative

    Contrary to what the article and link said, I don't think you can buy it (new) on bn.com. However, it is available here at amazon.com for 20.90 new or 9.00 used. Just fyi...

  3. Book spoiler by jmv · · Score: 5, Funny

    It ends with }

    1. Re:Book spoiler by david.given · · Score: 4, Funny
      It ends with }

      No, no, this is C++, remember? It ends with };.

  4. 900 pages! by Anonymous Coward · · Score: 2, Funny

    He should've used a little of that practical C++ for compression.

  5. Guilt by Anonymous Coward · · Score: 3, Informative

    Guilt free purchase link.

  6. I concur by gregarican · · Score: 4, Informative
    This book has been in my reference shelf for awhile now. Some areas are emphasized more than others -- arrays more than vectors, structs more than classes -- but overall it's a good companion.

    In terms of going over bit manipulation, memory addresses, pointers, etc. it really goes into detail that I wouldn't expect for an entry-level reference. Then again it's so thorough it really isn't just an entry-level reference!

  7. old!=obsolete by RLiegh · · Score: 5, Insightful

    If you're talking about the specifics of a language to the point where the book you're reading is going to be obsolete after the next standards commitee meets--maybe you're reading the wrong book?

    However, if the book you're reading concentrates on the principlas, instead of the individual bits and pieces, age shouldn't matter.

    They still use the ritchie book after all, right?

    1. Re:old!=obsolete by happyfrogcow · · Score: 2, Insightful

      Though if it were written based on compiler implementations of the C++ standard it may be old and obsolete, or at the very least, simply incomplete.

      For example, using exceptions as error handling, and moving it away from the normal operation of the code, instead of having tons of if..else cases everywhere right next to meaningfull algorithms. exceptions seem to be a relatively recent addition to C++ compilers as far as standard compliant compilers go.

  8. Cease and Desist by Sparky77 · · Score: 2, Funny

    Open Letter From Darl McBride:

    The code examples in this book are part of the intellectual property owned by SCO. You must pay $650.00 per code example to receive a license that allows you to use our IP. Send check or money order, no cash please.

    Thank You,

    Darl (Big D)

    --
    One bad monkey spoils the whole barrel.
    1. Re:Cease and Desist by Patrik_AKA_RedX · · Score: 5, Funny
      $650.00 per code example
      Lets assume 350 code examples, that makes $227,500
      A hit-man cost about $30,000. hmmm....
      Sorry Darl McBride, it's not personaly, it's just economics.
    2. Re:Cease and Desist by SW6 · · Score: 5, Funny
      Lets assume 350 code examples, that makes $227,500
      A hit-man cost about $30,000. hmmm....
      Sorry Darl McBride, it's not personaly, it's just economics.

      I clearly need to move to a nicer area. The going rate for a hit round here is less than a tenth of that. And the body would probably dissolve in the river...

  9. Best learner's C++? by FortKnox · · Score: 5, Informative

    (This book has been out for a few years; what books would make more sense today for a C++ learner's library?)

    Best learner's C++ book has to be "Thinking in C++" by Bruce Eckel. I always touted his "Thinking in Java" as the premier book for the learning java developer, but his success started with TiC++. Best of all? Its available free electronically on his website (but I always went out and spent the $30 for the paperback version to support him).

    If you pick up the book, you'll understand the language just a little more. He writes the book just how you'd like to learn, not like some math book that blandly gives out information in a manner that puts you to sleep. You can thank me later after reading it ;-)

    --
    Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
    1. Re:Best learner's C++? by Ed+Avis · · Score: 2, Interesting

      I found Stroustrup's book The C++ Programming Language to be quite good, at least if you already know some of the language. It's not quite a tutorial and not quite a reference manual but works nicely as a blend of both.

      --
      -- Ed Avis ed@membled.com
  10. On the subject of language by sczimme · · Score: 4, Informative


    From the review:

    Here we have a section which goes over everything from for loops to if conditionals while simultaneously using verbose, duplicitous language at every step.

    Umm, you do know that duplicitous means "Given to or marked by deliberate deceptiveness in behavior or speech", right? Or did you mean redundant?

    (The quoted definition was provided by http://www.dictionary.com.)

    --
    I want to drag this out as long as possible. Bring me my protractor.
    1. Re:On the subject of language by kfg · · Score: 2, Interesting

      Interesting. I read it to mean "simplified to the point where the author knowingly said things that weren't strictly true."

      A common trait of quicky introductions.

      KFG

  11. The one I used by proverbialcow · · Score: 4, Informative

    My C++ class used "Object-Oriented Programming Using C++" by Ira Pohl. The language was easy to understand, and it was aimed at people who'd done some coding, though it was necessarily a prerequisite. He somehow managed to make the subject accessible to newbies without condescending. A great book for beginners, and since I don't use C++ on a day-to-day basis, I find myself picking it up now and again.

    --
    The only surefire protection against Microsoft infections is abstinence. - The Onion
  12. The C++ Programming Language by ArmorFiend · · Score: 2, Informative

    I am in the market for this type of book, however, the one I have my eye on is:

    The C++ Programming Language (Special 3rd Edition)
    by Bjarne Stroustrup

    A reference is too hard too read, but this looks like it might be the right level - hopefully pretty steep, but with some language design chit-chat thrown in. What do others think of this book? (And what languages have you learned, a VB for dummies alum isn't going to give the same advice as Guy Steele)

    1. Re:The C++ Programming Language by johnjaydk · · Score: 2, Interesting
      The Bjarne book is good. No doubt about that. It's a bit steep for someone with no previous exposure to OOP but it covers a lot of good stuff.

      If you want the design rationale and evolution then I can recommend "The Design and Evolution of C++", also written by Bjarne. It's very helpfull not only to know how the language works but also why it was put together that way.

      --
      TCAP-Abort
    2. Re:The C++ Programming Language by Red+Leader. · · Score: 2, Informative

      I'm just learning C++, basically as an advanced beginner programmer (I already know Perl pretty well). I have Stroustrup's book, as well as one called "Data Structures and Other Objects Using C++" by Michael Main & Walter Savitch. Even for a beginner, Stroustrup's presentation is FAR superior to the one in Main & Savitch. The explanation of points is clear and there is some design chit-chat that doesn't distract much at all from whatever the section its in is really discussing. It's maybe a little bit advanced for me, but I'm here to learn, right?

    3. Re:The C++ Programming Language by drudd · · Score: 2, Insightful

      I've actually found that typos can be helpful for the learning student. Sure, in the short term they'll pull their hair out, but in the long term, when they make similar typos, they know what to look for, and how to diagnose problems.

      Doug

      --
      Venn ist das nurnstuck git und Slotermeyer? Ya! Beigerhund das oder die Flipperwaldt gersput!
  13. philosophical puzzlement by jejones · · Score: 4, Funny

    Overall, this is a solid book for an existing programmer to pick up C++ concepts.

    I'm not sure what books would be good for non-existing programmers.

    1. Re:philosophical puzzlement by EricTheGreen · · Score: 4, Funny

      Why, it's companion book, of course:

      Abstract C++ Programming

  14. C++ had its day by mugnyte · · Score: 4, Insightful


    For many, this C derivative is still a daily living. Thats fine. It's powerful enough.

    These days, most people approach C++ as a way to "write fast code" or they desired to get to a lower level of the machine. Or, they know C and want to learn all about OO programming. NO harm there either, although I question all these motives.

    For the most part though, end-user applications have no need to run in C++. I know the typical exceptions are in gaming, image processing and system internals, but this is a small subset of commercial programming.

    I think elementary programming skills can be taught in C++ (i've done it), but you have to peel away so much of the language, one might as well start from C anyway, and then explain OO, and then combine the two. However, the ancestry of the syntax hangs newbies too often.

    These days, I think the same goals in being "practical" could be achieved with Java for the same (if not less) effort. Plus, one learns the concepts of Events, Interfaces and a more useful standard library.

    I've cranked out over 100K of C++ (haha, not hard to do with low-density langs) but in the end, I wish it would have been a longer-lived system. Many of our framework pieces are now part of the standard Java libraries, and we would have saved quite a bit of time.

    But I think it's time for new programmers to move on.

    1. Re:C++ had its day by Brandybuck · · Score: 2, Insightful

      Rule One: The closer you program to the "metal", the closer to the "metal" the language you use needs to be.

      Ever seen a workable kernel or device driver written in Java? Of course you haven't! You get down to the that level and you'll see C interspersed with assembly. Move up a step to low level system software and it's all C with a smattering of C++. You don't find mid to high level languages until you get to the application level. (I'm not counting high level interpreted languages performing remedial scripting duties).

      --
      Don't blame me, I didn't vote for either of them!
    2. Re:C++ had its day by Screaming+Lunatic · · Score: 2, Insightful
      For many, this C derivative is still a daily living. Thats fine. It's powerful enough.

      Funny how you use "C derivative" in a derogatory way. You can also call Java, C#, Python, PHP, and Objective-C "C derivatives" too. They all use the same syntax style.

      For the most part though, end-user applications have no need to run in C++. I know the typical exceptions are in gaming, image processing and system internals, but this is a small subset of commercial programming.

      We'll ignore the fact that the browser, office suite, instant messenger, IDE, mp3 player, image editor and desktop is most likely written in C++ if not C.

      I think elementary programming skills can be taught in C++ (i've done it), but you have to peel away so much of the language, one might as well start from C anyway, and then explain OO, and then combine the two.

      That's how C++ is currently taught and is not the way it should be taught. This is the hello world program newbies should see.

      #include <iostream>
      class Output
      {
      public:
      Output()
      {
      std::cout << "Hello World\n";
      }
      ~Output()
      {
      std::cout << "Goodbye World\n";
      }
      };

      int main()
      {
      Output output;
      return 0;
      }
      Unfortunately it is not because the people teaching C++ think just as you think. That C++ is just a strongly typed C.

      These days, I think the same goals in being "practical" could be achieved with Java for the same (if not less) effort. Plus, one learns the concepts of Events, Interfaces and a more useful standard library.

      With respect to Events and Interfaces. Functors are much more powerful and generically useful than Events. Abstract base classes in C++ are the same thing as Interfaces in Java. Same concept, different syntax.

      With respect to libraries. Have you used the STL? Have you used Boost? Have you used Loki?

      I've cranked out over 100K of C++ (haha, not hard to do with low-density langs) but in the end, I wish it would have been a longer-lived system.

      I call B.S. From the rest of your post it seems like you don't even have a basic understanding of C++. Seems like you treat it like a strongly typed C with this fangled class thing.

  15. My favourite book is... by xiox · · Score: 4, Informative

    An excellent book is Accelerated C++ - Practical programming by example (Koenig & Moo). It only weighs in at 340 pages, but really helps the beginner to use things like the STL. It doesn't start off teaching basic C, but leaves pointers out until much later, and concentrates on using the STL data types.

    1. Re:My favourite book is... by ibeleaf · · Score: 3, Informative

      If you're interested in Accelerated C++, make sure you get a newer revision -- lots of errata in earlier copies:

      See http://www.acceleratedcpp.com/details/errata.html for a listing.

      I just ordered this from Amazon.ca... hopefully their copy is newer!

    2. Re:My favourite book is... by abigor · · Score: 2, Informative

      "Modern C++ Design" is an absolute mind-bender. I don't know if I'll ever use some of that stuff - I find doing singletons the old-fashioned way works for me, quite frankly - but it sure has opened my mind. That typelist stuff - whew. And just when you thought you knew everything about smart pointers...

      What I've taken away from that book is the incredible power and elegance of policy-based design. Every working C++ programmer should understand it, I think.

  16. practical? by beforewisdom · · Score: 4, Funny
    Any IT book that is over 900 pages should NOT have the word "Practical" in its title. IMHO

    Steve

  17. This book has been out a few years.. by osullish · · Score: 5, Funny

    Next review, punchcards in a nutshell (It being an O'Reilly book will have a T-Rex on the cover) :-)

    --
    It's hard enough to remember my opinions, never mind the reasons for them..
  18. Out of stock in the stores - available online by prostoalex · · Score: 2, Informative

    This book is available on Safari for subscribers. Cheapest subscriptions start at $10/month. If you're not a subscriber, you can still read the first few sentences of each chapter and section.

  19. My favourite C++ introduction book by 3Daemon · · Score: 3, Informative

    I just had to read up on C++. I'm no expert programmer, but having experience from C and Java (in addition to having learnt the basics of Object-Oriented methodology) I wanted a book that didn't try too hard to explain everything from the bottom.

    I found C++: The core language from O'Reilly incredibly useful in this respect. In its 200 pages, it might not cover every aspect of C++, but it will give you enough to go on so that you can start using the language. Being short and focused, it will give you a good understanding of the basics a lot faster than any larger book could, IMHO.

  20. Book sounds bad; read Accelerated C++ by afay · · Score: 4, Interesting

    From this review, this book sounds horrible. I can't stand books that:

    1.) Don't have a clear target audience (from the review it sounds too easy and too little details for a programmer and yet too hard for a complete beginner)

    2.) Seem like the author was paid by the page. Really, even for a complete novice, a well written book can teach C++ in less than 300 pages.

    Conclusion: Don't buy this book.

    That said, I really like Accelerated C++ for a novice programmer. The authors obviously know their stuff and it's very clear and concise. Lot's of good (not pointless little toy programs) examples that are clearly explained. Also, an example is built throughout a chapter so you don't have to comprehend everything at once. Finally, and this is the best part, STL is used from the beginning. Why save the best part of C++ for the end?

    Amazon link: Accelerated C++

    --
    Best slashdot comment
  21. For templates there is one excellent book by Chuchi · · Score: 3, Insightful

    C++ Templates The Complete Guide by Vandevoorde and Josuttis (ISBN 0-201-73484-2, Addison-Wesley) is an absolute must for anybody wishing to use templates (or discover new areas where to use templates).

    The book talks about all the aspects of templates, has plenty of clear examples.

    Apart from this I would not suggest the Stroustrup book for learning C++, but it is excellent as a reference manual.

    --
    Chuchi
  22. Copy of a stupid article by Animats · · Score: 2, Informative

    The above rant was copied from here.

  23. Enough with C++/C/Java books! We need wider topics by Anonymous Coward · · Score: 5, Insightful

    Isn't it time we start seeing reviews of books other than C/C++/Java/Perl/C#/HTML?

    I am a hard core C++ person myself, but even I am fed up with the series of similar books on these PLs.

    There are many other topics in programming that deserve better attention by the /. developer community. Examples from the top of my head:

    Books on

    - Code optimization techniques (both for C/C++ & assembly level and optimization for web programming and DB programming)

    - Algorithms and data structures - this one will never go away whatever high level garbage collecting foolproof language/framework you end up using.

    - Software design topics (design patterns and its relatives, UML, alternative paradigms such as extreme programming)

    - Software project management topics ...

    Come on people!

  24. about the title by Tumbleweed · · Score: 2, Funny

    'Practical' and 'C++'...something's not right there. :)

    1. Re:about the title by pavon · · Score: 2, Insightful

      Actually practicality is the only thing that C++ has going for it. It certainly is not the most elegant language, or the easiest to learn, or the fastest to write, or the least prone to programming errors. But it is powerfull and efficient, which is why it has been such a practical, popular language.

  25. Stroustrup Book by Black-Man · · Score: 2, Insightful

    It obviously is the bible... but I feel is more of a reference. I keep it on my bookshelf and use it often as a reference... there is no way you can sit down and read this like a text book. Way too dry.

  26. Why you young whelp! by Thud457 · · Score: 2, Funny
    There's no underestimating the contribution that the C language has made to computer science.

    C invented the dangling pointer. And it put the buffer overflow on the map.

    Kids these days. You have everything we worked hard for handed to you on a silver platter. You have no idea where these concepts even originated. PHAH!

    --

    the preceding comment is my own and in no way reflects the opinion of the Joint Chiefs of Staff

  27. learn from the gaming industry by Tekmage · · Score: 2, Interesting

    My personal favorite is C++ for Game Programmers.

    It's not a general-purpose book and not for the complete beginner, but it dives deeper into when and why to use different programming styles and structures.

    --
    --The more you know, the less you know.
  28. You can't be serious. by stonecypher · · Score: 4, Informative

    The Que book is littered with omissions and errors. If you want to learn C++, start with the free Bruce Eckel e-book Thinking in C++, then move on to the Meyers trio, the Sutter pair, Gang of Four, Dewhurst, Alexandrescu, then Agile Software Development, in that order.

    See Accu's booklist, EfNet #c++'s book list, or Yechiel Kimchi's list of bad books for opposing opinions.

    --
    StoneCypher is Full of BS
  29. Re:C AND C++ ARE THE WORST LANGUAGES EVER DEVELOPE by cluckshot · · Score: 2, Funny

    Except for all other languages...

    --
    Never Politically Correct ~ I prefer the facts If you don't like what I say, get a life, or comment yourself.
  30. Everything you ever wanted to know about C++... by witlessbird · · Score: 2, Informative
    But where afraid to ask:

    "The C++ Programming Language" by Stroustrup

    "Effective C++: 50 Specific Ways to Improve Your Programs and Design" by Meyers

    "More Effective C++: 35 New Ways to Improve Your Programs and Designs" by Meyers

    "C++ Templates: The Complete Guide" by David Vandevoorde

    --

    ... if you put into the machine wrong figures, will the right answers come out?
  31. Re:C AND C++ ARE THE WORST LANGUAGES EVER DEVELOPE by Mr+Smidge · · Score: 3, Funny

    Pah!

    C and C++ combine all the raw speed and power of assembly with all the grace and smooth design of assembly.

    (I heard that somewhere - don't know the original source).

  32. Re:C++ had its day...and it is today by dmeranda · · Score: 5, Insightful

    I find that those who write off C++ really don't know the language, or at least the "modern" standardized language. C++ is incredibly powerful, and if you use solid OO techniques you really shouldn't have many issues with memory management. At least in C++ (as apposed to Java) the language guarantees that all destructors will be called and with well defined ordering. That allows you to use resource allocation patterns that greatly simplify memory manangement or resource issues entirely.

    Although you can compare pure Java with C++ as languages, it is meaningless to compare a Java framework/JDK such as J2EE with C++, as the former is an entire environment, not just the underlying language. There's lots of stuff that C++ does better than Java (generics/templates, destructors, high-performance containers, abstract algorithms). Not to mention that C++ is a completely standardized and *free* language, whereas Java is a fast moving pseudo non-free standard.

    Oh, and the syntax problems you complain about are not really all that different from Java, or even C#. Yes, they are each somewhat different and some have cleaner syntaxes for specific issues, but in the grand scheme of computer languages they are almost the same. And there are syntax problems with Java too which C++ doesn't suffer...they are both strongly based upon a C foundation, like C#, Javascript, etc.

    And yes, I've written very large C++ projects with many developers very successfully, and C++ has proven to be a very nice language indeed as long as you take the initial time to learn it correctly rather than out of a C++ for Dummy's tutorial.

    Now if you want to talk high-level languages (both Java and C++ are low-level of approximately the same power), then you should be talking about something like Python, or more academically Haskell. But Java is by no means a high level language, just as C++ is not.

  33. duplicitous != redundant by uncadonna · · Score: 2, Insightful

    did the reviewer really mean duplicitous as in fraudulent, or did he just mean to say redundant?

    --
    mt
  34. Re:*pure* beginner book? by kilgortrout · · Score: 2, Interesting

    I don't know if it's still available, but my first programming book was: "C++ How To Program", by Deitel/Deitel which was originally published in 1994. It's an excellent book and if it's been republished/updated, might be worth a look. It's designed for people with little or no programing experience.

  35. Re:Enough with C++/C/Java books! We need wider top by yamla · · Score: 4, Insightful

    Stop complaining and write a review yourself.

    --

    Oceania has always been at war with Eastasia.
  36. Re:learner's library by rjshields · · Score: 2, Informative

    A low level langage like C++ is definitely not for them.

    D'oh!

    All the books I've read have told me that C++ is a high level language! I must be reading the wrong books!

    --
    In this world nothing is certain but death, taxes and flawed car analogies.
  37. Re:Stereotype, that C/Cis "just faster" by plover · · Score: 2, Funny

    Actually, I think it would go a lot faster without all those gratuitous commas. They really slow down the pre-parser.

    --
    John
  38. About those authors... by devphil · · Score: 2, Informative
    The authors obviously know their stuff

    Most definitely... since they were part of the group that helped develop the language from the beginning. They work down the hall from Stroustrup, and they are brilliant, brilliant people.

    Koenig has done all kinds of work in almost every aspect of the language and the library (if you've ever wondered why your compiler isn't finding names correctly, that's because it isn't doing Koenig lookup properly), and Moo wrote one of the first "native code" C++ compilers ever, meaning that it doesn't translate to C before going to machine code.

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
  39. What should be in a trult practical C++ book by frenchgates · · Score: 2, Interesting

    Why do most of the books ignore the practical aspects of of C++ that end up wasting tons of programming time, especially for beginners? Primarily I'm talking about things like how to keep tons of #include files under control and debug problems with them in your own code or existing code you are using or evaluating. How to organize source code into various directories for use by multiple projects. When and how to create compiled libraries. How to make DLLs on different operating systems as opposed to applications. And on and on.

    There are a million books about how to program in c/c++, but how about how to get actual work done in c?

    --
    Syntax error: loose != lose, affect != effect, then!=than
  40. Re:C AND C++ ARE THE WORST LANGUAGES EVER DEVELOPE by SlayerDave · · Score: 2, Informative

    I couldn't agree less. It is not difficult at all to avoid memory leaks and segfaults, if you know what you are doing. Some simple rules like match every 'new' with a 'delete' and use 'delete []' if you used 'new []' will prevent the majority of these problems. Setting pointers to NULL before allocation with new and after deallocation with delete will allow you to check that your pointers are valid. But then you'd know all this if you had read 'Effective C++' and 'More Effective C++' by Scott Meyers, which are the two most useful programming books I've ever read. Meyers teachs that it's not hard to write good, correct C++ code if you know what you are doing.

  41. Re:C AND C++ ARE THE WORST LANGUAGES EVER DEVELOPE by tchernobog · · Score: 2, Insightful

    In fact, Mr. Knuth wrote "The Art Of Computer Programming" with MIX...

    Anyway, for those who love java and such languages... you simply like them because you don't have to know what you're doing. I say: first learn C or C++ AND assembly, then learn java (or other high-level languages), so you'll have a grasp on what the compiler/interpreter does with what you write, and you'll understand the other ones fully. Don't hate pointers... they're your best friend.

    Btw, why do you think that c and c++ are so widely used still today, if they suck so much?

    --
    42.
  42. good c++ programmers avoid new by bunbunbun3 · · Score: 2, Informative
    new (and delete) should really be rarely used in modern C++ programming. Use smart pointers instead.

    The standard has autoptr. Boost (www.boost.org) has loads more useful variants. 99% of the time, heap memory (i.e. allocated via new) instead of stack memory (automatic variables) is only used so that you can allocate variable amounts of memory. By using smart pointers, you can have the flexibility of new as well as the safety of automatic variables (they deallocate out of scope).

    When used as class member variables, smart pointers provide clear ownership of resources, helping programme design.

    new and delete are also classically used to manage buffers. This should be done entirely with strings, vectors and deques nowadays.

    For modern c++ programmes, run of the mill memory errors are really inexcusable, just as they are in Perl (my other favourite language). I am a full time programmer and have not had a memory/buffer error in years (yes, I have written countless kLOC and, yes, my programs have all sorts of other bugs ;-] )

  43. Re:C++ had its day...and it is today by Anonymous Coward · · Score: 2, Insightful
    There's lots of stuff that C++ does better than Java (generics/templates, destructors, high-performance containers, abstract algorithms). Not to mention that C++ is a completely standardized and *free* language, whereas Java is a fast moving pseudo non-free standard.

    *cough*... Oh, you are ignoring the C++ ABI. Which of course is the best thing to do when it comes to the C++ ABI. And which of course is also what most C++ tool writers have been doing as much as they can. I just went to the PalmSource conference, and they announced that they are using C++ in PalmOS 6, but they aren't exposing any C++ APIs from the operating system to the app writer because there is not yet a standard C++ ABI for the platform they're running on. C++ has been around for at least, what 15 years now, and there is still no standard ABI, so you are pretty much forced to stick with one proprietary ABI or to compile everything (shared libraries included) all at once if it is meant to work together and/or match up the versions carefully.

    Meanwhile, in Java, despite the fact that the language has changed some, the ABI is basically constant across time and across platforms. So you can build your class libraries with whatever tools you want, one time, and they just work with anything else that wants to call them or be called by them. This is a Good Thing.

    I'm not saying that Java is superior to C++, I'm just saying there are some things that Java does waaaaaay better than C++. Plus, I'm also reacting against the wording "completely standardized" in reference to C++. It's just not true.

    By the way, I agree neither Java NOR C++ is a high-level language...