Slashdot Mirror


Effective C++, Third Edition

nellardo writes "If you've been programming C++ for any length of time, you probably have the book, Effective C++, by Scott Meyers on your shelves. Well, this book has just hit its third edition, and it's a major re-write and re-org. Do you need this book? If you program C++, yes, you probably do, even if you have a previous edition. Don't let the "Third Edition" faze you, because it has lots of new insights into the vagaries of the C++ language. And if you're new to C++, this is pretty much a must-own book." Read on for the rest of Nellardo's review. Effective C++, Third Edition author Scott Meyers pages 297 publisher Addison Wesley rating 9/10 for C++ programmers; not worth it otherwise reviewer nellardo ISBN 0321334876 summary Re-write of standard second book on C++

C++ is a large and complex language, and always has been. That's what made the first edition of Effective C++ so useful. What began as a simple concept of "C with Classes" grew as time went by, developing quirks and foibles that made sense only once you understood a great deal about what was going on. The first edition provided short, digestible synopses of the best practices of quality C++ programming. Even people that had been programming C++ for years could read the book and pick up something new.

That was 1991. A lot has changed in C++ since then. For instance, templates were only just being developed as an addition to the language, and most C++ compilers simply generated C code. Now, in 2005, C++ has gotten a great deal more complicated, and C++ templates have turned out to be a programming language in their own right. Exceptions, the Standard Template Library, threading libraries, and a wealth of truly inventive programming have turned C++ into an amalgam of concepts and mechanisms from essentially every programming language under the sun (ahem). C++ isn't quite as complex as Ada, but that's a much tougher case to make today than in 1992.

In addition, the understanding of what the best practices actually were has changed. Indeed, common tricks from 1991 are now generally frowned upon. In 1991, a friend function was common in code examples. For instance, operators were routinely declared as friend functions. Now, in 2005, friend is seen as creating the tightest coupling possible between components, and is often avoided. What happened?

This is where the book's background starts to shine. Item 1 is "View C++ as a federation of languages." Meyers does a clear and cogent job of decoding broad swathes of C++, explaining C++ as a multi-paradigm tool, and placing language features in different paradigms. Change paradigms and the guideline for what makes for effective C++ changes. This is a hard case to make, but he manages to do it in accessible language even a newbie to the language should be able to follow. Experience from 1991, 1997 (the second edition, mostly a spruce-up job of the first), and now add up to explain the boundaries.

Like earlier versions of the book, the final items provide a good hint on how to keep current. Item 54 is "Familiarize yourself with the standard library, including TR1", and Item 55 (the last) is "Familiarize yourself with Boost." Both of these point to the two places C++ is most likely to grow in the near future, TR1 being essentially done, and Boost being an active source of new things likely to make it into future language extensions.

While 55 items isn't as neat as 50 items, the items in the middle still provide a good place to start for a new C++ programmer. The experienced C++ programmer (the kind who's running around their department suggesting simply using Sutter and Alexandrescu's C++ Coding Standards as the department's new coding standards as is) may not get as much from the book, but it isn't really looking for that programmer. It is advertised as a "second book" on C++, and that's exactly what it is. Buy your textbook to learn from, then buy this book.

Can the experienced C++ programmer get something from the book? Sure, but it's more along the lines of having a handy way to explain to the new guy in the next cube why you want to make sure exceptions never leave a destructor (Item 8) rather than having to figure out a clear way to say it yourself. If nothing else, the more experienced programmer may want to read it just to know what the new guy is likely to ask about.

As a book per se, it's nicely done. It uses color judiciously, mainly to point out the most important parts of the code examples. It also includes lists of items from More Effective C++ and Effective STL, which are handy, albeit blatant plugs. More interestingly, it includes a map from the items in the first edition and the second edition to the items in the third edition (in both directions). This makes it clear that this book truly is a substantial re-write. I would have liked to see a list of all the items, along with the two or three bullets that summarize them as a separate table (maybe on the front inside cover for easy access), but that's a minor point.

All in all, Effective C++, Third Edition is exactly what it claims to be. A significant re-write of the best second book out there. Learning C++? Then pick it up. Using C++ actively with a bunch of other programmers? Pick it up. Not using C++? Don't bother.

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

296 comments

  1. Object-oriented design patterns. A necessity! by CyricZ · · Score: 4, Insightful

    One of the strong points is its discussion of object-oriented design patterns. These days OO design patterns are just as essential as iteration when programming in languages like C++. But unfortunately, many C++ books fail to mention such patterns, and how they can be used to help make software development quicker, more efficient, and more resistant to errors.

    --
    Cyric Zndovzny at your service.
    1. Re:Object-oriented design patterns. A necessity! by Rei · · Score: 2, Informative

      Does the book discuss const correctness? I am always annoyed, when using a library written by someone else, if they don't const things like char* variables that aren't getting changed. It makes you either have to not const your own code, or copy to a non-const array (i.e., extra code and poor performance).

      --
      Sigur RÃs: I didn't know that Heaven had a rock band.
    2. Re:Object-oriented design patterns. A necessity! by Anonymous Coward · · Score: 0

      Yes, "Item 3: Use const whenever possible" provides a discussion of this.

    3. Re:Object-oriented design patterns. A necessity! by Anonymous Coward · · Score: 0

      Or just const_cast locally - no performance hit there. And it still leaves your interfaces const correct.

    4. Re:Object-oriented design patterns. A necessity! by samkass · · Score: 1

      Const correctness is important, but is only one of many pitfalls/advantages to C++. Overuse of static (non-thread-safe) variables, overuse of nested templates without typedefs, and crazy operator overloading often have worse effects to C++ productivity, IMHO.

      Of course, I've been programming in pure Java for a couple years now, so my near-decade of C++ experience is actually getting a little rusty.

      --
      E pluribus unum
    5. Re:Object-oriented design patterns. A necessity! by Old+Wolf · · Score: 1

      If you know the library function isn't going to modify the object, use a const_cast:

      char const *ptr = "abc";
      puts( const_cast(ptr) );

    6. Re:Object-oriented design patterns. A necessity! by Rei · · Score: 1

      That only works if you know for certain that they're not modifying the object for some obscure reason in the other function. Usually you're pretty sure, but you don't know absolutely. if you're wrong, your const assumptions throughout your program are all ruined - i.e., you might as well just remove all of your const declarations, because they could be lying to you. Duplicating your array is the only way to ensure that they're not.

      What you really want is the library developer to be const correct with their functions in the first place.

      --
      Sigur RÃs: I didn't know that Heaven had a rock band.
    7. Re:Object-oriented design patterns. A necessity! by Anonymous Coward · · Score: 0

      There I was, a woman of 47 years, dressed in my Victoria's Secret black, lacy stockings and velvet choker, and butt plug-- lying atop a king-sized bed in a tiny honeymoon inn overlooking the ocean. I was awaiting the arrival of a young man I'd only "met" via a reply to a piece of raw, erotic "literature" I'd submitted to an Internet newsgroup.

      Oh, we'd gotten to know each other through email. I'd even watched a homemade video (created especially for me) featuring you masturbating to orgasm. I'd been fascinated by the extreme dimensions of your youthful cock, but also by the volume and range of the ejaculation as it spurted from the tip of your awesome organ. Three times we'd brought one another to orgasm--over the telephone! And speaking of fascination, how can I omit the two bits of 'jewelry' adorning the hidden areas of your body.

      You. had mentioned several times (before sending the video), that you'd had a hot secret, but wouldn't let on to me exactly what it was. You are a tremendous tease--a trait that seemed to turn me on to the point of my pussy thumping madly on the seat of my chair. The video revealed the secret--not one, but two hidden piercings: the right nipple, and a larger ring known as a P.A. (for Prince Albert, beloved consort to Queen Victoria).

      The rather large ring first pierced the skin right at the rim of your cock and then emerged through the hole on top. In the video, you. showed how freely the ring could be spun around, and intimated how much your orgasms have intensified since having it instilled. Judging by the amazing stream of cum in the video, I had no doubts of the veracity of that statement. I'd experienced three orgasms as I massaged my own pussy during the course of watching the video.

      Another bit I'd discovered was that you love giving spankings. I'd never even considered the sexual excitement inherent in being on the receiving end...but reading your descriptions of this activity in a fantasy you'd written for me had left me sopping wet and throbbing so hard I'd been forced to masturbate--right in my office!

      Already at this point, I'd crossed more barriers than ever before in my life. But there was yet another to traverse--turning a virtual computer affair into a real experience of the flesh. And I was MAD to do it!

      An opportunity arose for me to visit a city not too distant from the one in which you lived and worked. It was to be a business trip with four colleagues, but if we planned it properly, we just might be able to have a day and night together.

      Each of us had agreed not to masturbate for the week preceding our rendezvous. But I, finding myself in bed one night, literally shaking with desire, had broken the promise. You had not. So you had a week of sexual tension building up, hoping for a tremendous explosion as a result of our first encounter. You would not be disappointed--nor would I.

      So there I lay, in the throes of one of those "Oh God, have I really done this?" moments of doubt and fear, waiting for your plane-delayed arrival. Sooner than expected, I heard a soft rapping on the balcony door. Leaping from the bed, I fumbled with the door latch to find you standing before me--your full 6'3" frame towering above my petite 5'4"...

      In order to bring our eyes to the same level, you quickly sat down on the arm of an upholstered chair near the balcony door. I stood in the "V" produced by your very long legs, my belt buckle pressed against your belly. We shook hands. In a second I'd placed my hands on either side of your face and begun to kiss your mouth. Gently at first...very gently, as you'd imagined in yet another written fantasy, describing this meeting. Your lips were soft, and just the right level of moisture....I could feel the heavy pulsing between my thighs as I forced my tongue between your lips, alternately sucking each of them, then sucking your huge tongue; sucking it deep into the back of my mouth. You moaned softly.

      I couldn't be coy about this. In a flash,

  2. I only have one book on programming by AviN456 · · Score: 2, Insightful

    The only book I own on programming is ANSI C :p

    --
    - Just because we CAN do a thing, does not mean we SHOULD do that thing.
    1. Re:I only have one book on programming by exp(pi*sqrt(163)) · · Score: 2, Funny

      What made C so hard for you that of all languages you needed a book for just this one?

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    2. Re:I only have one book on programming by AviN456 · · Score: 1

      nothing, I just havent bothered to buy any books on proramming in over 10 years, I got that one when i first started.

      --
      - Just because we CAN do a thing, does not mean we SHOULD do that thing.
    3. Re:I only have one book on programming by jimbolauski · · Score: 1

      How can you live with out Vc++ for Dummies

      --
      Knowledge = Power
      P= W/t
      t=Money
      Money = Work/Knowledge so the less you know the more you make
    4. Re:I only have one book on programming by Paralizer · · Score: 4, Informative

      Great book, I have it too. It's perfect for reference if you're having one of those horrid brain cramps, but it is nothing to learn from IMO. If you're just starting out grab another book, the one the story is talking about looks interesting. I'm not much on C++, but it looks great for those of you who really want to get a foothold on the language. Of course, even if you know C++ it's always helpful to try out pure C too.

      The book the parent is talking about is here http://www.amazon.com/exec/obidos/tg/detail/-/0131 103628/qid=1118258760/sr=8-1/ref=pd_csp_1/102-7661 598-1944930?v=glance&s=books&n=507846, C Programming Language (2nd Edition) by Brian W. Kernighan and Dennis Ritchie, the guys who created the language.

    5. Re:I only have one book on programming by PyWiz · · Score: 1

      Personally, I think it's a great book to learn from. I learned C from it myself and I never had any real difficulty. I liked how it was clear, concise, and to the point as opposed to most 900 page doorstops on learning C which have the same amount of content with about 700 pages of added fluff. Also the exercises at the end of each chapter both reinforced the lessons and helped me know if I needed to review something. All in all, I think The C Programming Language is a great book for a beginning C programmer to start with (although probably not good if you haven't done any programming at all).

      --
      -py
    6. Re:I only have one book on programming by ArielMT · · Score: 1, Interesting

      And ANSI C is perhaps the best general purpose programming language out there. The C Programming Language ought to be required reading, if it isn't already.

      As for C++, it's C-- as far as I'm concerned. I honestly can't think of a more painful language to program in. Not even BF and Intercal are more painful than C++. And reading three books on C++ haven't helped.

      --
      It must be Windows. It needs half a gig of RAM and a hardware-accelerated graphics card just to run Solitaire.
    7. Re:I only have one book on programming by Anonymous Coward · · Score: 0

      You can't spell very well. It's spelled "VB", not "VC". Of course, once you've used a language as powerful as VB for years on end, you learn how to spell the acronym. :)

    8. Re:I only have one book on programming by jimbolauski · · Score: 1

      so Visual C++ is VB that doesn't make too much sense to me.

      --
      Knowledge = Power
      P= W/t
      t=Money
      Money = Work/Knowledge so the less you know the more you make
    9. Re:I only have one book on programming by Dayze!Confused · · Score: 0

      Maybe he thought you ment to post Vc--

      --
      "All tyranny needs to gain a foothold is for people of good conscience to remain silent." [Thomas Jefferson]
    10. Re:I only have one book on programming by Anonymous Coward · · Score: 1, Informative

      Which three books did you read? There are hundreds of books on C++ and many of them are not very good. The book mentioned in this review happens to be one of the good ones though.

    11. Re:I only have one book on programming by MightyMartian · · Score: 1

      Hah, I'm waiting for C^^ or C@@. I bet C~~ will be a real winner. Of course, we all know the ultimately goal is C$$.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    12. Re:I only have one book on programming by Yokaze · · Score: 1

      > As for C++, it's C-- as far as I'm concerned. I honestly can't think of a more painful language to program in.

      For all intents and purposes C++ is a superset of C (ignoring C99). So, how can be C++ more painful to program in?

      Show me C-code, which cannot be used in C++ (excluding with the most trivial changes, like dynamic arrays to std::vector).

      Then try to realise the C++ code which Alexandrescu showed in "Modern C++ Design" in C and compare the results.

      Heck, even if I'd have to program purely imperative, I'd still choose C++ over C purely for the possibility to use of STL, Boost and other C++-libraries.

      Yes, the errors on templates can be hard to parse. Yes, the peculiarities of inheritance, virtual functions and the various algorithms and data-structures of STL can be quite disturbing.

      But here is the kicker: You don't have to use any of them, but you can if you want.

      --
      "Between strong and weak, between rich and poor [...], it is freedom which oppresses and the law which sets free"
    13. Re:I only have one book on programming by Just+Some+Guy · · Score: 4, Insightful
      That's a shame. See (pun), no matter how much you like it, and no matter how 1337 it makes you, there is much more to programming than ANSI C.

      Do you know any functional languages? Can you (intelligently) debate Perl vs. Python? Do you know why Fortran can be much faster than C? Do you believe that a virtual machine can be faster than assembler? If you said "no" to any of those, yet refuse to look past your C knowledge, then you're depriving yourself of a lot of good learning.

      There's a vast difference between "I haven't gotten around to it yet" and "I've already solidified my way of thought". You seem to take pride in the latter, and for that I feel sorry for you.

      --
      Dewey, what part of this looks like authorities should be involved?
    14. Re:I only have one book on programming by Finuvir · · Score: 1

      The grandparent surely wasn't talking about K&R. He said "ANSI C" was the book he has, while K&R makes it clear that it is not the standard, but is merely informative (not normative).

      --
      Why is anything anything?
    15. Re:I only have one book on programming by Anonymous Coward · · Score: 0

      --
      A deity capable of creating an entire universe is obviously capable of deceiving you


      And Mother Theresa was obviously capable of slipping you a mickey and then sodomizing you with a broomstick. So what?
      You must live in a frighteningly chaotic and barbarian universe, inside your head.

    16. Re:I only have one book on programming by Anonymous Coward · · Score: 0

      K&R 2nd edition is ANSI C. The first was not (I have both).

      Slashdot requires you to wait 2 minutes between each successful posting of a comment to allow everyone a fair chance at posting a comment.

      It's been 8 minutes since you last successfully posted a comment

      Slashcode is teh l33t.

  3. I recall... by rd4tech · · Score: 1

    (A bit off topic but...)
    once upon a time (before the development team fixed the bug) c+=c+++++c; to be perfectly valid :) It was a mighty looking statement.

    1. Re:I recall... by exp(pi*sqrt(163)) · · Score: 1

      Your C++ grammar is impeccable, and I'm sure you have a funny story to tell, but your English is so unparsable I can't tell what you're trying to say. Could you say it again?

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    2. Re:I recall... by Rei · · Score: 1

      That one's great ;) And in theory, you could have chained them:

      c+=c+++++c+c+++++c+c+++++c+c (etc). That would make a nice border in an obfuscation contest.

      My favorite obfuscation technique is sticking the little-used comma operator where people don't expect it. For example:

      int a,b;
      a=123,456 - 123,455;
      printf("%d\n",a);

      --
      Sigur RÃs: I didn't know that Heaven had a rock band.
    3. Re:I recall... by rd4tech · · Score: 1

      Another idea, way ago, on the older IDE's , there was a foreign language 'o' which looked Exactly like 0. :)

    4. Re:I recall... by Anonymous Coward · · Score: 0

      Fixed the bug? Why isn't that legal anymore? It would add one, double, and one, double, right?

    5. Re:I recall... by Anonymous Coward · · Score: 0

      Bug? How is there a bug in that statement?

      that translates to "c = c + ((c+1)+1) + c;"

      While poor style, is that really an invalid statement?

    6. Re:I recall... by Dayze!Confused · · Score: 0

      Actually, having a pre condition operator it would more likely be, c=(c+1)+((c+1)+1)+(c+1)

      --
      "All tyranny needs to gain a foothold is for people of good conscience to remain silent." [Thomas Jefferson]
    7. Re:I recall... by eggoeater · · Score: 1

      try again.....
      c += c++ + ++c
      c = c + (c+1)+(c+1)
      the increment operator (++) takes precedent over addition (+).
      So the parser (should) created the second formula above.

    8. Re:I recall... by Dayze!Confused · · Score: 0

      But what you are missing is the fact that ++c increments c first before all the other operations take place. Here is the program that I used to prove my concept:

      #include <iostream>

      using std::cout;
      using std::endl;

      int main(){
      for(int i=0;i<5;i++){
      int c=i;
      c+=c++ + ++c;
      cout<<c<<endl;
      }
      }

      The output being:

      4
      7
      10
      13
      16

      I learned about this in my beginning C class at a community college.

      --
      "All tyranny needs to gain a foothold is for people of good conscience to remain silent." [Thomas Jefferson]
    9. Re:I recall... by neil.pearce · · Score: 1

      No, what you are missing is that the order in which the right hand side of the expression is evaluated is undefined.

      A compiler may perform the c++ before the ++c.
      A different compiler may perform the ++c before the c++

      Another compiler could switch between either method, dependent on optimisation settings or even something as ridiculous as the day of the week

      Any of the above would be deemed to be correct interpretation of the language.

      Do not base your knowledge on how your favourite compiler operates.

    10. Re:I recall... by Jerry+Coffin · · Score: 2, Informative
      c += c++ + ++c c = c + (c+1)+(c+1) the increment operator (++) takes precedent over addition (+). So the parser (should) created the second formula above.

      You've modified c three times without any intervening sequence points, which gives undefined behavior. See http://dspace.dial.pipex.com/town/green/gfd34/art/ and click on "bloopers", or just Google for "nasal demons" (honest!)

      Also note that if you don't insert spaces yourself, "c+++++c" is NOT tokenized as "c++ + ++c" either -- it's tokenized as "c++ ++" and then lexing will normally stop because what you have is illegal. Google for "maximum munch".

      --

      The universe is a figment of its own imagination.

      --
      The universe is a figment of its own imagination.
    11. Re:I recall... by Anonymous Coward · · Score: 0

      he's right. it is undefined, therefore compiler dependent. I just read that in the ISO standard 2 nights ago. couldn't sleep, but sequence points knocked me right out.

    12. Re:I recall... by Anonymous Coward · · Score: 0
      Even better, use operator presidence and the comma operator together:
      int a = 1, b = 2;
      int c = a + b, 4;
      printf("%d\n",a);
    13. Re:I recall... by nickos · · Score: 1

      This problem is even worse when you remember that the comma is used instead of the decimal point in many non-English speaking countries.

    14. Re:I recall... by Anonymous Coward · · Score: 0

      The lexical analyzer now consumes as many characters as it can to create a valid token, so the expression is treated as "c += c++ ++ + c;", rather than "c += c++ + ++c;". The "++" operator requires an lvalue. The expression "c++" is not an lvalue. That makes the expression syntactically invalid.

    15. Re:I recall... by Jerry+Coffin · · Score: 1
      I just read that in the ISO standard 2 nights ago. couldn't sleep, but sequence points knocked me right out.

      ...and some people complain about the standard being the size of a small bed!

      --

      The universe is a figment of its own imagination.

      --
      The universe is a figment of its own imagination.
  4. Amazon link. by Anonymous Coward · · Score: 0
    1. Re:Amazon link. by Intron · · Score: 2, Informative

      B&N price: $42.74
      Amazon: $44.99
      Bookpool: $34.95

      --
      Intron: the portion of DNA which expresses nothing useful.
    2. Re:Amazon link. by Anonymous Coward · · Score: 0

      Take your prices and shove em up your karma whoring ass!

    3. Re:Amazon link. by Anonymous Coward · · Score: 0

      Thank you Mr. Affliate Whore. Click the above link if you would like to line the pockets of the above Anonymous Coward.

  5. Finally some great info in a review by Anonymous Coward · · Score: 4, Funny

    Just from reading the front page, I've learned that Effective C++ may be more useful to C++ programmers than those of other languages AND that the "Third Edition" may contain new insights not found in the previous editions. Slashdot needs more reviews like this.

    1. Re:Finally some great info in a review by idonthack · · Score: 1

      Silly mods, "Insightful" isn't for sarcasm.

      --
      Why is it that when you believe something it's an opinion, but when I believe something it's a manifesto?
  6. Do people still write new C++ code? by Anonymous Coward · · Score: 0
    Most of the live C++ code i've seen 'in the field' dates from the early-mid 90s. All the cool new stuff is in Java or .NET. Why would anyone choose a legacy language like C++? It seems nuts, if you must use a difficult-to-read language, surely pearl is the way forward with its large library of modules. Or possibly Ruby?


    Anyone contemplating new C++ developments nowadays needs their head examined.

    1. Re:Do people still write new C++ code? by lastchance_000 · · Score: 1

      Performance?? I can't imagine a real-time rendering engine (i.e., games) in .NET or java.

    2. Re:Do people still write new C++ code? by JeanBaptiste · · Score: 1

      "All the cool new stuff is in Java or .NET. Why would anyone choose a legacy language like C++? " Where does C++ .NET fit in then?

    3. Re:Do people still write new C++ code? by Paralizer · · Score: 2, Interesting

      Obviously you don't know much about C++, or programming for that matter. C++ is a great language for almost any task. Java needs that crappy VM (I'm not saying Java is bad, it's just not my cup of tea), and .NET... is that even ported to other operating systems yet (maybe the mono project, but I'm not sure how far developed that is)? The point is C++ is fully portable, easy to use for most tasks, and is powerful.

      Hell, I still like C over C++, simply because I feel like I'm really in control of whats going on when I write it, and that I feel I have a better understanding of how it's being executed. If you like this new stuff like Java (and I should point out I don't know Java, or do I have any desire to learn it), you're really not in control of what's happening. Some people that write Java don't even know what the heap is, they don't concern themselves with memory management because it's so difficult to free dynamicly allocated memory with Java.

      C++ is by no means an anceint or dead language, hell no.

    4. Re:Do people still write new C++ code? by Rei · · Score: 2, Informative

      A "legacy language"? Apparently it's so legacy that "modern" languages like Java are racing to implement its features. Modern C++ features like templates are really a godsend in many application development projects - check out the internal structure of ITK if you want a good example of that. :)

      Of course, I may simply be feeding a troll here (a slashdotter misspelling "perl"? Come on!).

      --
      Sigur RÃs: I didn't know that Heaven had a rock band.
    5. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 0

      Yeah, and of course 99% of professional programmers are going to need to write real-time rendering engines all the time.

    6. Re:Do people still write new C++ code? by 0xABADC0DA · · Score: 0, Flamebait

      Performance?? I can't imagine a real-time rendering engine (i.e., games) in .NET or java.

      You might need a bit of code in C for that for performance, but most of a game is better done in Java or C#. Games like World of Warcraft actually include their own scripting language and garbage collector. These could be compiled to bytecodes on load and run at full speed instead of being interpreted and using a much slower GC. It would also enable them to do a lot more cool stuff; instead of C++ where you have to explicitly write code to let a script do something you could, in Java, say what it couldn't do if you wanted to.

      There are plenty of examples of game engines being written other languages you might not think are suitable, like LISP for instance. The game industry mostly uses C++ these days due to inertia (all those existing engines / code written in C++) and ignorance rather than performance. Incidentally, that's also why the OS isn't written in a safe language -- there's no technical reason favoring C/C++ over Java/C# for an OS.

    7. Re:Do people still write new C++ code? by plopez · · Score: 1

      for the same reason people still need to learn COBOL and FORTRAN. Someone has to maintain the legacy code! :)

      --
      putting the 'B' in LGBTQ+
    8. Re:Do people still write new C++ code? by clayasaurus · · Score: 1

      C++ is old school yes, but if you don't want to rely on a VM and want object oriented programming with templates, it is the only way to go.

      Unless, of course, you are adventerous and willing to give the D programming language a shot.

    9. Re:Do people still write new C++ code? by rd4tech · · Score: 1

      You don't know what are you talking about. Java and .NET might be 'cool' languages, but from my experience the C/C++ projects are still paid more and have more stable salary. BTW, just for fun, the site in my SIG was done in C++. PHP (as a cool language) wasn't fit for a task because my server kills scripts after 30 seconds.

    10. Re:Do people still write new C++ code? by Intron · · Score: 1, Insightful

      "Java needs that crappy VM"

      So when did C++ start running on bare hardware? Every time I've run it, I needed an OS and a huge pile of libraries. Is there something inherently worse or different about loading a VM than loading libraries?

      "C++ is fully portable"

      Because source code portability is so much easier than binary portability? Lets see you recompile something written for Windows on AIX and have it run the first time. I've done that in Java.

      --
      Intron: the portion of DNA which expresses nothing useful.
    11. Re:Do people still write new C++ code? by Brandybuck · · Score: 2, Insightful

      Why would anyone choose a legacy language like C++?

      Maybe it's because some of us are writing software for the real world?

      --
      Don't blame me, I didn't vote for either of them!
    12. Re:Do people still write new C++ code? by rd4tech · · Score: 1

      No, but they NEED one anyway.

    13. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 0

      Anyone contemplating new C++ developments nowadays needs their head examined.

      And they'll be saying that about Java and .Net by the end of the summer...

    14. Re:Do people still write new C++ code? by Brandybuck · · Score: 2, Interesting

      Incidentally, that's also why the OS isn't written in a safe language -- there's no technical reason favoring C/C++ over Java/C# for an OS.

      1) OS dependent on VM
      2) VM needs OS to load
      3) Lather, rinse, repeat

      --
      Don't blame me, I didn't vote for either of them!
    15. Re:Do people still write new C++ code? by kibbylow · · Score: 1

      Of course people still write new C++ code. Java has it's place in software developement for cool and flashy things, but it will never be as fast as a well designed and coded C++ application.

      Try selling any kind of large scale real-time management system to a telecomms provider. They'll laugh at you and escort you off their site.

    16. Re:Do people still write new C++ code? by exp(pi*sqrt(163)) · · Score: 3, Insightful
      Just about all games come equipped with their own script engines. But who the do you think writes the engines and what language do you think they use?

      The reason why there are so many people around saying we should use Java and C# is ignorance. These people have never had to write code where performance matters. I work on a large graphics application that uses Python bindings to make it easy to use. But we still have to develop non-Python part using a language whose performance doesn't suck beyond belief. If we don't, then the competition will be faster.

      At this point I usually have to endure the lecture about how slow code can be speeded up with good algorithms. But we have some of the best people in the field working on our algorithms and still need more speed. There is no choice but to use C++.

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    17. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 0

      there's no technical reason favoring C/C++ over Java/C# for an OS.

      You clearly have no experience at writing an OS or any part thereof, except perhaps a userspace driver.

      I would love to see you try putting a VM in kernel space without C or C++.

    18. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 0

      No offense, but I really don't think you know what you're talking about.

    19. Re:Do people still write new C++ code? by drspliff · · Score: 0

      "So when did C++ start running on bare hardware? Every time I've run it, I needed an OS and a huge pile of libraries."

      Well then mister.. you obviously haven't tried hard enough, it is perfectly possible to write kernel-level code in C++ as long as you implement the 'new' and 'delete' functions which are required to create and delete objects.

      A reference if you need it: http://www.mega-tokyo.com/osfaq2/index.php/Doing%2 0a%20kernel%20in%20C%2B%2B

      Oh my god.. dont tell me.. you have to write your own memory manager?... dumbasss, if you're writing bare-level C code you'll have already done that.

      In future.. think before you type, and you'll be relieved of the pain of being publicly insulted on slashdot..

    20. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 0
      Is there something inherently worse or different about loading a VM than loading libraries?
      Yes, there is something inherently different. Try using some of that "insight" you got there to figure it out.
    21. Re:Do people still write new C++ code? by mmusson · · Score: 1

      The Java Advanced Imaging API in the JDK offers a C-based library called mediaLib that accelerates the imaging functions because the pure Java versions can't achieve good performance.

      Sun would never say this publicly but internally they recognize that Java can't achieve the performance of good optimized C code.

      --
      SYS 49152
    22. Re:Do people still write new C++ code? by exp(pi*sqrt(163)) · · Score: 2, Insightful

      What's cool and written in Java or .NET?

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    23. Re:Do people still write new C++ code? by GGardner · · Score: 1

      This is the same reason that you can't write a C compiler in C.

    24. Re:Do people still write new C++ code? by mmusson · · Score: 1

      Actually, Java is the new legacy code. :)

      --
      SYS 49152
    25. Re:Do people still write new C++ code? by ded_guy · · Score: 1

      Some people that write Java don't even know what the heap is, they don't concern themselves with memory management because it's so difficult to free dynamicly allocated memory with Java.
      Wouldn't it be amazing if the Java runtime had functionality to automatically clean up unreferenced memory? It'd be like picking up trash in the memory to make it usable again. We could call it a "Garbage Collector."
      I'd better go patent that.

      --
      In the future, all spacecraft will be made of cheese.
    26. Re:Do people still write new C++ code? by Lord+Duran · · Score: 2, Insightful

      No, this is the same reason that you couldn't write the FIRST C compiler in C.

    27. Re:Do people still write new C++ code? by mmusson · · Score: 1

      I had a professor that once said something to the effect that low level, high performance languages like C/C++ may not be the best choice in language for all projects but they are the best choice for the really interesting ones like OSes.

      --
      SYS 49152
    28. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 0

      Actually, it is possible to write an operating system in a language such as Java - just write a boot loader (or something equally fundamental) that initializes the VM via binary code (it can even be written in Java, if you use a binary compiler on the bytecode) and start loading modules.

      The thing that bothers me is the performance hit that I've seen in all of the Java programs I've ever written due to the garbage collector, and that's why I still prefer C++.

    29. Re:Do people still write new C++ code? by exp(pi*sqrt(163)) · · Score: 1

      That was merely one example. The total proportion of programmers who write real time rendering engines, real time simulation engines, real time image processing engines, real time audio engines, real time process control engines and so on is not trivial.

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    30. Re:Do people still write new C++ code? by marktoml · · Score: 1

      >Lets see you recompile something written for Windows on AIX and have it run the first time.

      As long as we are talking console vs. GUI, then yes...done that too. STL goes a long way towards making this not hurt so bad.

      It is merely a matter of preference in most cases unless requirements raise their ugly head :) A lot of us still prefer C++.

    31. Re:Do people still write new C++ code? by drgonzo59 · · Score: 1
      Good point, besides if people really whine about speed they can always use JNI, that is what we did for our CAD product. We already had a large library of C and FORTRAN libraries and we wrote the functionality of the new appliation in Java yet used libraries through the JNI and it worked out great.

      By the way, some of the games out there that require fast rendering are done mostly in Java for example IL-2 Sturmovik made by the Russian company C3 is written in java but some of performance crititical code is in C or C++, you couldn't tell that its Java - its very fast (unlike Swing!)

    32. Re:Do people still write new C++ code? by 2short · · Score: 1

      "So when did C++ start running on bare hardware? Every time I've run it, I needed an OS and a huge pile of libraries."

      It compiles to machine code that runs on (relatively) bare hardware. It calls OS and library functions that also run on relatively bare hardware.

      "Is there something inherently worse or different about loading a VM than loading libraries?"

      Worse? Depends. Different? Definitely. A VM and a library are not comparable things. In terms of performance, running on a VM is worse than "bare hardware". In terms of platform-independence, it's better.

      Java is definitely more portable than C++. "Run the first time" is still unlikely in my experience, but whoever says C++ is "fully portable" has never ported anything of significance. If you want to write the same thing for Windows and AIX, Java is obviously the way to go. If like me, you're very concerned about performance, and rate the chances of wanting to ever port to another platform as somewhere between slim and none, C++ is clearly superior.

    33. Re:Do people still write new C++ code? by lobsterGun · · Score: 1

      Nice post, but I fear you've been trolled. Nobody with even half a brain actually believes C++ is a good thing.

    34. Re:Do people still write new C++ code? by Tyler+Durden · · Score: 1

      What's cool and written in Java or .NET?

      You must be kidding. Why right off the bat you have Azureus and Eclipse written in Java.

      Yup 2 whole cool apps written in Java. Other than that? Well, err... let's see. Oh, I got it! Business Enterprise applications!

      Whoo boy what fun! Hundreds of different ways to move large quantities of money from point A to point B for corporations providing services of questionable benefit to mankind. Just thinking of developing one of these suckers makes me want to kill myself with joy.

      You C/C++ lusers can take your embedded software, operating systems, video games and such and stick them where the sun don't shine.

      --
      Happy people make bad consumers.
    35. Re:Do people still write new C++ code? by b17bmbr · · Score: 1

      I wouldn't say "it will never be as fast as a well designed and coded C++ application."

      well designed and coded versus language are two entirely different concepts. any well written program will run better than a poorly written one. period. we tend to think of java as slow, but it's the gui (swing) that's slow. as for java itself, comparing two comparable algorithms, there is little difference. now, why would i choose java per se over c++. here's an example: in my AP Comp Sci class, we created a swing, multi-threaded client/server chat program. 3 classes, total LOC 200. no it wasn't "perfect", but it worked rather well. try that in c++, any toolkit. had all 25 kids in the class in concurrent chat session, while running the server on a win98, P2 w/64MB ram. that is just one example. we did many others. but where java loses X% performance, it makes up for in speed of development and security. as for binaries, one, processor speed is making a JVM a moot point, plus, gcj4.0 does a fairly nice job of creating native java binaries so i've read.

      --
      My problem? I was perfectly gruntled, until some numbnuts came by and dissed me.
    36. Re:Do people still write new C++ code? by bluGill · · Score: 1

      Wouldn't it be neat if programs automatically closed all resources when you were done with them? It would be like a book flying back to the bookshelf when you are done reading!

      Amazingly, C++ supports this with a concept called RAII (resource allocation is initialization). Your file handles automatically close for you when you are done. Your classes come and go as you need them, without needing to worry about memory yourself. Shared auto pointers work great. They are not perfect, but they solve a lot of problems.

      Java can't do this, because the detractors are not called when you are done with the class, they are called sometime latter when the garbage collector gets around to it. This means that you might still have a file locked when you tell a different program to work with it.

      Get with modern C++. Garbage collection is neat, but it prevents RAII.

    37. Re:Do people still write new C++ code? by everphilski · · Score: 1

      Lots of modeling and simulation code is written in either C++ or Java (more often than not C++). I write modeling and sim code for a defense project in C++, a friend of mine writes wargame code in Java. OOP is a great boon to modeling and simulation people, many of whom have deep roots in FORTRAN.

      IAAAE (I Am An Aerospace Engineer)

      -everphilski-

    38. Re:Do people still write new C++ code? by vorpal22 · · Score: 1

      As a Ph.D. student in combinatorics, if I even suggested writing the computationally intense programs that we require to generate, enumerate, or search for combinatorial objects in C# or Java, I'd be laughed out of the department. There's no way either C# or Java are up to the task when performance is that crucial.

    39. Re:Do people still write new C++ code? by ded_guy · · Score: 1

      Garbage collection is primarily interested in reclaiming memory, a resource where it makes good sense to reclaim it lazily. You are right that lazy collection is a Bad Thing for other system resources (file handles, database connections, etc.) that need to be cleaned up in a more prompt fashion. You are, however, wrong in implying that garbage collection and RAII are mutually exclusive. See IDisposable in .net with the C# ``using'' statement for an example where a good design pattern and a little syntactic sugar make an excellent compromise.

      Cleaning up scarce resources is unfortunately still best done manually (with some help from the language to prevent your forgetting), but my original point still stands -- namely that it's not a fault when a programmer working under a garbage collected environment doesn't concern himself with trivial details of *memory* management. This usually isn't a problem with *well-written* C++, but it gets pretty hairy when you're forced to juggle pointers (and not everyone is using auto_ptr (or shared_ptr) yet).

      (And before you consider me a flaming zealot, I still prefer C++ for most of my personal projects. It's too tough to part with <algorithm>, after all.)

      --
      In the future, all spacecraft will be made of cheese.
    40. Re:Do people still write new C++ code? by Wolfier · · Score: 1

      Indeed, the reason I use C++ is performance.

      However, I'm not aiming for HIGH, but PREDICTABLE performance.

      You take a look at a loop and you'll roughly know how long it's going to take to run for C++ without GC.

      Until Java or C# supports true destructors (i.e. I should be able to tell the GC that I want to delete this object whenever I want, not the GC want), a lot of people, myself included, will not use it for systems programming.

    41. Re:Do people still write new C++ code? by TERdON · · Score: 1
      Hundreds of different ways to move large quantities of money from point A to point B for corporations providing services of questionable benefit to mankind. Just thinking of developing one of these suckers makes me want to kill myself with joy.

      Only if you get to move large amount of money from A to B, except a small amount going to C (your account).

      If not, I'll happily keep my embedded system projects, thank you.

      --
      I have a really elegant proof for Fermat's last theorem. If this sig was only a bit longer...
    42. Re:Do people still write new C++ code? by 0xABADC0DA · · Score: 0, Flamebait

      Parent:
      Java and C# are slow because Python is slow

      And that's suppose to be insightful? Python is slow. Java and C# are not. The only reason these languages show up lower in benchmarks are array access checks and, for Java, no stack-based variables.

    43. Re:Do people still write new C++ code? by Locke2005 · · Score: 1

      Java has it's place in software developement for cool and flashy things, but it will never be as fast as a well designed and coded C++ application. True, because even compiled Java does more run-time checking than C++. So do Perl, Python, Ruby, and .Net. By that same token, C++ has it's place, but will never be as fast as a well designed and coded C application, because dereferencing through a vtable is slower than calling functions directly. Which might be why drivers and operating systems are still written mostly in C, with a little bit of assembly thrown in for very hardware-specific functionality.

      --
      I've abandoned my search for truth; now I'm just looking for some useful delusions.
    44. Re:Do people still write new C++ code? by Locke2005 · · Score: 1

      Funny, Ruby seems to acheive the same functionality without resorting to templates, perhaps because unlike C++ and Java, in Ruby everything is an object.

      --
      I've abandoned my search for truth; now I'm just looking for some useful delusions.
    45. Re:Do people still write new C++ code? by Intron · · Score: 1

      Perhaps you're right. The responses to my post were pretty funny, too.

      --
      Intron: the portion of DNA which expresses nothing useful.
    46. Re:Do people still write new C++ code? by David's+Boy+Toy · · Score: 1

      Java will be a legacy language before C++, and .NET well before that. Thats the big problem with commercial languages rather than open standard languages. Some executive makes a decision and your code is now all obsolete.

      Code I wrote in C and C++ on Linux in 1992 is still in use, and can still be compiled with only minor tweaks.

      Java is basically castrated C++, take out anything that might be dangerous. Meaning anything which can be used to make truly optimal code. Meanwhile not even providing higher level programming features like generic programming capabilities.

    47. Re:Do people still write new C++ code? by 0xABADC0DA · · Score: 2, Informative

      Yes, clearly machines running Smalltalk and LISP kernels never existed. And squeak developers are lying when they say its virtual machine is written in smalltalk.

      And the reason why
      for (x=0; x < 10000000; x++)
      getpid();

      takes 1 second due to system call overhead instead of 0.001 seconds is because C is such a great language for operating systems... hint: it's one instruction in a "safe" OS (ie not C/C++).

    48. Re:Do people still write new C++ code? by Rei · · Score: 1

      That's not because Ruby uses only objects; c++ templates can have an object as the template type as long as it implements the operators/functions used by the templated class. The reason Ruby achieves the same functionality without templates is because Ruby is interpreted. I.e., Ruby only gets away with it because it sacrifices memory and performance to be more generic. Have you seen how badly Ruby usually benchmarks?

      (note: gcc tends to optimize poorly, especially old versions icc often optimizes to as much as twice as fast as gcc. And yes, I know that this is C being benchmarked, not C++, but performance should be similar)

      Proposing a language that's not even 1/25th as fast as C++ is not a realistic replacement. When your language makes perl look lightning fast by comparison, you have problems.

      --
      Sigur RÃs: I didn't know that Heaven had a rock band.
    49. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 1, Insightful

      Lets see you recompile something written for Windows on AIX and have it run the first time. I've done that in Java.

      I've done that before routinely. well, linuxwindows. GCC really is a marvelous thing. The first time I did it by mistake, I was doing part of a data analysis project and couldn't find the binaries, so I just pulled my sources and recompiled it and ran it, only to later remember that I usually ran that part of the analysis on the linux side.

      Problem is that as soon as you need windowing or threading, Java is easier to get working than C++, so I do use Java for those. But otherwise I stick with C++.

      It loads faster (the OS and libraries are all loaded, and linking in DLLs is so efficient it puts loading a VM to shame), it runs faster (I've checked a few times when I implemnted in both), it leaves me free to pull off nasty tricks if I need a performance boost, it saves memory I can use for my data, the STL and friends are better than in Java, and multiple other things that makes me prefer it.

      Obviously my experience comes from data-processing applications (data mining and such). If you're building web applets or small games or other things, your preferences might vary.

    50. Re:Do people still write new C++ code? by Peaker · · Score: 1

      There is no choice but to use C++.

      How about C? How about Pyrex?
      Writing most of the product in Python and just implementing the performance-critical parts in Pyrex or C is much easier than writing it with C++ and creating bindings for Python.

      It would also be just as fast, because almost always, less than 10% of the code runs more than 90% of the time.

    51. Re:Do people still write new C++ code? by Peaker · · Score: 1

      Well, C++ developers usually use some sort of reference counting schemes.

      In such a case, they suffer from the same predictability problems of GC systems.

      Also, a lot of GC'd languages have stack-based optimizations to recognize they can destroy an object that's only used in a function locally.

      Also, a lot of GC'd languages allow you to control exactly when the GC runs, which allows for predictable performance as well.

    52. Re:Do people still write new C++ code? by Locke2005 · · Score: 1

      There is no technical reason why Ruby must always be interpreted. It could, like Python, be used to generate machine code. That being said, Ruby, Perl, and Python would still be slightly slower than C++ even compiled, as C++ does compile-time type checking whereas in the other languages almost all checking is done at run time.

      --
      I've abandoned my search for truth; now I'm just looking for some useful delusions.
    53. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 0

      So I assume that you write in assembly, since its still 2-3 times faster than C?

    54. Re:Do people still write new C++ code? by Fulcrum+of+Evil · · Score: 1

      Modern C++ features like templates are really a godsend in many application development projects

      Where I work, we love STL - the only downside is our old gcc version that generates 200M binaries with about 700M of symbols. I hear that's fixed in recent versions, though.

      --
      "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
    55. Re:Do people still write new C++ code? by Rei · · Score: 1

      Python generates bytecode, not machinecode (didn't you ever wonder why .pyc files would run on any system, even though they're "compiled", or why the docs talk about "compiled" in quotation marks?). *Big* difference. Besides, even if Ruby was physically compiled, it would require what effectively amounts to cpu-eating wrappers around every object and every interface.

      --
      Sigur RÃs: I didn't know that Heaven had a rock band.
    56. Re:Do people still write new C++ code? by exp(pi*sqrt(163)) · · Score: 1
      No, I'm just talking about the fact that you use the best tool for the job. I'm happy to mix and match languages as needed. I'll use a slow language where expressiveness is important and the underlying engine will be in C or C++ where performance matters. If Java was either as fast as, or more expressive than C or C++ we might have used that.

      "The only reason...no stack-based variables". That's like some loser claiming "My Ford Focus is only slower than a Ferrari because the engine is crap". Doesn't anyone out there write real code? These things are so f-ing obvious.

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    57. Re:Do people still write new C++ code? by Locke2005 · · Score: 1

      I was thinking py2exe actually converts byte code to machine code. Apparently it doesn't. My main point stands, there is no reason why you couldn't convert byte code to machine code

      --
      I've abandoned my search for truth; now I'm just looking for some useful delusions.
    58. Re:Do people still write new C++ code? by vsprintf · · Score: 2, Interesting

      Nobody with even half a brain actually believes C++ is a good thing.

      Oops (no pun intended), I must've lost half my brain while learning C++. There's nothing wrong with OOP when applied correctly to C in the proper situation. There's nothing wrong with C when a procedural approach is better, and in the end, C++ is often just a better C compiler.

      My problem is that the book is probably *Meyers doing templates* again. When templates first came out, I was sold on the idea. Years later, it seems that in practice, you have to write ever more code to cover every possible invocation and possible use. Now, it seems to me that templates are more useful to compiler and library writers than in the real programming world.

      *Dons hairshirt garment and waits to be burned as a heretic.*

    59. Re:Do people still write new C++ code? by MrCopilot · · Score: 1
      Yes, It's true. Some of us work in the embedded field outside of the dark zone of winCE. I actually enjoy C++ and its quirks. I have not come across anything I can't do, that I need to do. What I need to do it does perfectly ask Trolltech.

      C++.NET doesn't fit anywhere in my Linux Arm Device. Java does but it's tricky.

      Damn, subtle little troll.

      --
      OSGGFG - Open Source Gamers Guide to Free Games
    60. Re:Do people still write new C++ code? by Locke2005 · · Score: 1
      --
      I've abandoned my search for truth; now I'm just looking for some useful delusions.
    61. Re:Do people still write new C++ code? by Brandybuck · · Score: 1

      I wish some of these people bitching C/C++ would try to write a device driver in Java, or .NET. C and C++ were designed for writing system software, and the funny thing is, they're still good for writing system software. The "religious" languages were designed for writing high level applications, which is why the suck for writing anything at a lower level.

      --
      Don't blame me, I didn't vote for either of them!
    62. Re:Do people still write new C++ code? by Brandybuck · · Score: 1

      C compiles to native code and doesn't require a runtime. Java and .NET compile to bytecode and require virtual machines. See the difference?

      If you don't see the difference, please send me your Java device driver, because I would be very interested in looking at it.

      --
      Don't blame me, I didn't vote for either of them!
    63. Re:Do people still write new C++ code? by baxissimo · · Score: 1

      I'm guessing he uses C++ instead of assembly because he wants to actually get his programs written and debugged before he's 40.

    64. Re:Do people still write new C++ code? by CrazyTalk · · Score: 1

      Well, I just started a C++ program today. Many reasons to use it, but peformance is a biggy over C#/Java - not to mention increased flexibility, compatiability with legacy code, greater control over low level operations (important when dealing with things like barcode scanning or speech recognition). The list of useful things C++ can do goes on...

    65. Re:Do people still write new C++ code? by GGardner · · Score: 1
      Some Java and .NET implementations compile to bytecodes, others don't. Some C systems are interpreted.

      And as far as the Java device driver, check out:

      http://www.amazon.com/exec/obidos/ASIN/0201183935

    66. Re:Do people still write new C++ code? by CrazyTalk · · Score: 1

      C# DOES support finalize and Dispose methods - finalize runs when GC runs (also unpredictable) but Dispose runs when you want it to. Not quite effective as C++ destructors, but for most applications not a bad compromise.

    67. Re:Do people still write new C++ code? by CrazyTalk · · Score: 1

      Well, its not practical for the vast majority of programmers, but there ARE people who write in Assembly where size (think embedded devices) and performance demand it.

    68. Re:Do people still write new C++ code? by WarPresident · · Score: 1

      The Java Advanced Imaging API in the JDK offers a C-based library called mediaLib that accelerates the imaging functions because the pure Java versions can't achieve good performance.

      Urf. Don't speak about the JAI. I used it for a "simple" computer vision project years ago, and it felt like I was manipulating something held together with razor wire and duct tape.

      --
      Here come da fudge!
    69. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 1, Insightful

      The reason it takes less time in Java is that the VM already made the call, and can return the answer from its own internal data. The system object has it there already.

      In C, the compiler cannot assume that the return of getpid() will not change, so it is called each time. You cannot avoid system call overhad, just avoid making system calls unneccesarily.

      In C, you can simply call getpid() once, and keep the result to get the same effect as the VM has. Try it with a system call that cannot be cached, like read()ing a byte at a time from a file descriptor of "/dev/urandom".

    70. Re:Do people still write new C++ code? by creeront · · Score: 1
      Try selling any kind of large scale real-time management system to a telecomms provider
      Funny, then why does Verizon, the world's largest telecom provider use a management system written in VB.net (and yes, they bought it from another company)? Don't get me wrong, I don't like VB.net, which by many is not considered a language, but not everything will be written in c++, either. High level languages have their place - rapid application development, reusability and maintainability. By the same token, so does c++, which is the de facto language for every OS with clout.
    71. Re:Do people still write new C++ code? by OzBeserk · · Score: 1

      My understanding is that it's almost impossible to do any realtime systems in java. I've just come off a complex traffic control systems project done in C++ to meet the very strict failure response time requirements.

      Now I'm working on a finance back office system in J2EE. Horses for courses.Java/J2EE is great for GUI/enterprise stuff. C++ is great for control systems and high performance components.

      It's easy to get caught up in the hype regarding the newest wiz-bang developement techs that will make all others redundant. For those of us simply wanting to solve problems in a efficient, mercinary like way, there's massive value in using a proven techs for a given problem space while the early adptors bed down the newer techs.

    72. Re:Do people still write new C++ code? by Rei · · Score: 1

      Note that python is inherently about 130 times slower than unoptimized C with an old compiler, according to the previous benchmark. Giving it a typical 2-4x speedup (as per the psyco docs) still means it is pathetically slow. The reason, again, is that everything is wrapped extensively, overly checked, mostly unoptimized (because many types of optimizations break when you change datatypes), etc. Ruby will suffer the exact same thing. If you want generic interfaces to objects to allow you to avoid templates, you have to suffer overhead as your penalty. And these languages take a lot more penalties than that - for example, bounds checking on every array access. They're inherently slow.

      Do I have to get into how the actual assembly code varies between code generated with a template over one datatype and another to show you why if you care about performance at all, you need to know your datatypes ahead of time?

      --
      Sigur RÃs: I didn't know that Heaven had a rock band.
    73. Re:Do people still write new C++ code? by gadzook33 · · Score: 1

      Seriously, I find this entire thread hard to believe. Anyone who has to deal with performance or security in any meaningful way whatsoever is laughing at the suggestion that C++ is "old school". And anyone who wants to try and explain that a "sandbox" actually creates security needs to go back to school.

    74. Re:Do people still write new C++ code? by Brandybuck · · Score: 2, Interesting

      Some Java and .NET implementations compile to bytecodes, others don't.

      And the ones that don't still require a runtime. I would actually switch to Java for a lot of things if I could get one that would compile to native code and didn't require anything more than a standard libc.

      And as far as the Java device driver, check out...

      Except that it doesn't run on my OS. It doesn't run on any of my friends' OS. Heck, it doesn't even run on Sun's OS, and they own Java! JavaOS is like the Lisp Machine: It's a nice concept but no one really uses it.

      p.s. Without having to buy the book, and since you seem to be the expert on this, how does JavaOS manage to bootstrap the VM? Does it cheat and use a C/C++ layer on top of Mach?

      --
      Don't blame me, I didn't vote for either of them!
    75. Re:Do people still write new C++ code? by Brandybuck · · Score: 1

      The people who think this way are the same people who think that Java/.NET code can't possibly have any security issues because it can't possibly have any buffer overflows.

      --
      Don't blame me, I didn't vote for either of them!
    76. Re:Do people still write new C++ code? by scotch · · Score: 1
      You're comparing apples and tangerines - either you need to make the system call 1 million times or you don't - the fact that java guesses for you for this particular function that you don't need to make the call every time is a fluke. Using it as an example is disingenous. For other system calls that can't be cached, java and C will have similar performace; i.e., slow - and the java will be marginally slower because that's just the way it is. Here, I'll give you some free code such that C++ will exceed the performane of java for your stupid example:

      namespace idiot
      {
      int getpid ()
      {
      static int pid = getpid ();
      return pid;
      }
      }
      --
      XML causes global warming.
    77. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 0

      I absolutely guarantee that that function will take infinitely longer than any java version :)

    78. Re:Do people still write new C++ code? by scotch · · Score: 1

      Whoops, int pid = ::getpid (). That's what you get for free. For $9.95, you can have the infinitely faster version. For $29.95, you canhave the version that's slight faster yet. For $1M, I'll come over to your house and tell you the process id whenever you need to know it.

      --
      XML causes global warming.
    79. Re:Do people still write new C++ code? by GGardner · · Score: 1
      how does JavaOS manage to bootstrap the VM?

      Well, I've never touched JavaOS, but I just cited it as probably the most well-known example. There's lots of cases of safe languages used as OS implementation languages, from the Lisp machines to Xerox's Cedar system, to the TCP stack that someone (CMU ?) wrote in ML.

      Keep in mind when we say that the Linux kernel is written in C, it isn't really written in ANSI C with the standard runtime, it is written in a subset, with some assembly language magic here and there. You can't call fopen() from the kernel! Same is true for Java as OS -- sure, you can't use the bog-standard Sun hotspot vm as a kernel, but you can program in a subset of standard java to build an OS. You generally need a system which compiles java to machine code, and you generally need to link in a bit of assembly to get things going. Then, all you really need is a little bit of JNI help (or VM magic support), to be able to read and write raw device registers, and away you go.

    80. Re:Do people still write new C++ code? by brpr · · Score: 1

      You can avoid system call overhead by writing the OS in a safe language, removing the need for memory protection and the kernel/userspace divide.

      So there.

      --
      Freedom is not increased by mere diminuation of government. Anarchy is freedom for the strong and slavery for the weak.
    81. Re:Do people still write new C++ code? by brpr · · Score: 1

      For other system calls that can't be cached, java and C will have similar performace...

      You should read the post you're replying to. He's not comparing the performance of Java and C, he's comparing the time taken to make a system call on an OS written in a low-level language like C (with the associated memory protection overhead) with the time taken to make a system call on an OS written in a safe, high-level language (e.g. a Lisp machine OS). If you write the OS in a safe language, you can get rid of the kernel/userspace divide and the overhead which it creates.

      --
      Freedom is not increased by mere diminuation of government. Anarchy is freedom for the strong and slavery for the weak.
    82. Re:Do people still write new C++ code? by scotch · · Score: 1

      I was unaware that your typical jvm could run more than one unrelated process.

      --
      XML causes global warming.
    83. Re:Do people still write new C++ code? by brpr · · Score: 1

      Again, read the post you're replying to. He wasn't talking about JVMs, he was talking about operating systems written in safe, high-level programming languages. Get with it!

      --
      Freedom is not increased by mere diminuation of government. Anarchy is freedom for the strong and slavery for the weak.
    84. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 0

      You would need a CPU that can run everything in ring 3, which simply can't be done. You cannot handle pagetables in a language like Java.

      You are welcome to try, but you will need some C and/or asm in there.

    85. Re:Do people still write new C++ code? by scotch · · Score: 1
      My apologies, clearly you and the poster are correct. However, in my defense, the OP was responding to a claim about Java and C# and an implementation language for an OS. That original claim stuck in my head for the entire conversation. It seems that he and you are claiming the similarities between java and smalltalk/lisp, for example, are strong enough that the demostrated art in the latter is evidence for the claim wrt the former.

      Certainly the fact that the equivalent of a context switch can be much lighter weight in a virtual machine than it can in your typical C OS implementation is important for some classes of applications.

      Am I sufficiently with it now?

      --
      XML causes global warming.
    86. Re:Do people still write new C++ code? by brpr · · Score: 1

      OK. I think VMs are a bit of a red herring here though. Using a high-level language (VM or no VM) allows you to get rid of memory protection, and this is what can make system calls much faster (*). In fact, the language needn't even be high level, it just needs to have bounds checking and constrained pointer semantics -- Fortran would probably do the trick. In the real world, where there aren't any mainstream OSs written in safe languages, this is admittedly an academic point, and you're quite right that there's no reason why Java should be faster for repeatedly calling UNIX system calls.

      (*) If there's no memory protection, calling a system call is just like calling any other function. There's in fact not any very clear boundry between different applications at all -- you just have a number of different threads of execution.

      --
      Freedom is not increased by mere diminuation of government. Anarchy is freedom for the strong and slavery for the weak.
    87. Re:Do people still write new C++ code? by P-Nuts · · Score: 1
      When templates first came out, I was sold on the idea. Years later, it seems that in practice, you have to write ever more code to cover every possible invocation and possible use. Now, it seems to me that templates are more useful to compiler and library writers than in the real programming world.

      It is true that it's harder to write templated classes than non-templated classes. It's also true that template class libraries are often more useful and reusable than non-templated classes. However, library writers do actually exist in the real world! How else do all those libraries get written?

    88. Re:Do people still write new C++ code? by Brandybuck · · Score: 1

      Linux isn't writtin in ANSI/ISO C because it insists on using GCC extensions. But there's no reason it couldn't be. The BSD kernels are all ANSI/ISO C. Even though they can't call fopen() from the kernel. Why? Because the standard library is distinct from the language! This is a concept that Java just can't get through it's head.

      A C/C++ compiler is totally ignorant of any Standard Libraries. It treats a call to fopen() no differently than a call to my_non_standard_function(). This is why C and C++ are so popular with embedded developers, because they aren't saddled with extra baggage. Yes, Java is being used in some cellphones. According to a friend of mine who writes embedded Java for Nokia, it's one of the biggest mistakes the cell phone industry ever made.

      --
      Don't blame me, I didn't vote for either of them!
    89. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 0

      Actually it is. Java is just a reinvention of everything old-school, virtualized. Visual Basic had garbage collection eons ago. Java has the same old tired multithreading primitives. I want something higher-level for the coming prevalence of multi-core processor desktops. J2EE is the just more of the old problematic way of objects directly calling interfaces on other objects. Too tightly-coupled. Web services/SOA is much better. Java supports the OOP paradigm, which has been around forever. But only that paradigm. C++ supports metaprogramming and procedural programming. You can use the best style for the job. Java has not advanced the art of software development one bit. It's for implementing legacy systems in the same old ways.

    90. Re:Do people still write new C++ code? by vsprintf · · Score: 1

      However, library writers do actually exist in the real world! How else do all those libraries get written?

      Yes, I should have chosen a better adjective than real. :)

    91. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 0

      You don't know what are you talking about. C and C++ might be 'cool' languages, but from my experience the Lisp projects are still paid more and have more stable salary. It's always something, isn't it?

    92. Re:Do people still write new C++ code? by Anonymous Coward · · Score: 0

      Well I don't totally agree with you but you are totally correct that there is nothing stopping a Java program from being well designed and coded. Probably saved me from writing a much incomprehensible rant.

    93. Re:Do people still write new C++ code? by brpr · · Score: 1

      and .NET... is that even ported to other operating systems yet (maybe the mono project, but I'm not sure how far developed that is)?

      It's more or less fully developed, as a quick trip to Google would have told you. The only thing missing from a portability aspect is a mature implementation of Windows.Forms.

      --
      Freedom is not increased by mere diminuation of government. Anarchy is freedom for the strong and slavery for the weak.
    94. Re:Do people still write new C++ code? by brpr · · Score: 1

      if you care about performance at all, you need to know your datatypes ahead of time?

      Not if you have an optimising JIT. Then you only need to know your datatypes at runtime.

      --
      Freedom is not increased by mere diminuation of government. Anarchy is freedom for the strong and slavery for the weak.
    95. Re:Do people still write new C++ code? by brpr · · Score: 1

      Modern C++ features like templates are really a godsend in many application development projects

      Of course, static polymorphism has been implemented much better in functional languages (e.g. ML and Haskell). The C++ attempt is painfully verbose and hacked-on.

      --
      Freedom is not increased by mere diminuation of government. Anarchy is freedom for the strong and slavery for the weak.
    96. Re:Do people still write new C++ code? by brpr · · Score: 1

      Or you could use OCaml. That has static polymorphism, objects (both superior to the C++ equivalents) and native code compilation.

      --
      Freedom is not increased by mere diminuation of government. Anarchy is freedom for the strong and slavery for the weak.
    97. Re:Do people still write new C++ code? by master_p · · Score: 1

      Look at what these people are saying though (I am the one that supports C++ in that thread!). These people are giving C++ a bad name, yet they are totally unaware about its capabilities. C++ is the greatest programming language ever (feel free to flame me) considering the large set of domains that it covers.

    98. Re:Do people still write new C++ code? by master_p · · Score: 1

      Hey, look what miracles (for example, here, here or here) can be done with C++ templates!

    99. Re:Do people still write new C++ code? by 0xABADC0DA · · Score: 1

      With an OS written in a safe language, for safe languages, everything runs in ring 0. You don't have to use page tables; you can if you want to, with no requirement for any more assembly than otherwise.

  7. Re:Effective? by Eric+Giguere · · Score: 2, Informative

    An obvious troll, but... if you are interested in Java, check out Joshua Bloch's Effective Java, written in the same style as Effective C++. Great book for similar reasons.

    Eric
    Old stuff: The ANSI Standard: A Summary for C Programmers
  8. TR1 is interesting by xYoni69x · · Score: 1

    I've nearly given up on C++ as an Effective language. But...
    TR1 is interesting. C++ may be useful again in 2-6 years (time for TR1 to become semi-standard, and for major compilers to accept it).

    --
    void*x=(*((void*(*)())&(x=(void*)0xfdeb58)))();
    1. Re:TR1 is interesting by dummondwhu · · Score: 1

      I've nearly given up on C++ as an Effective language.

      void*x=(*((void*(*)())&(x=(void*)0xfdeb58)))();


      Gee...I never would have guessed... ;-)

    2. Re:TR1 is interesting by Anonymous Coward · · Score: 0

      Interesting for sure. A better idea than Boost if you ask me. I hate Boost because it's too big. It has some good stuff, some crappy stuff, some low level stuff, some high level stuff, a horrible build system, and as a whole it's huge. Just annoying and poorly planned. They might as well just have set up a CPAN type system. Forget trying to make "standard" stuff.

      Plus a lot of stuff in Boost doesn't make programming easier. They take such a convoluted or over-engineered approach to certain things that you don't gain anything.

      TR1 looks better because it just has the "most needed" type stuff in it. Simple and generic. Loki has some nice stuff in it too.

      I don't think you will have to wait 2 years. It's probably doable right now. Compilers are much better than they were a few years ago.

      --
      OK, this is my last post on Slashdot... WTF is wrong with this thing? "You need to wait 2 minutes... It has been 48 minutes"... What moron wrote this code?!

    3. Re:TR1 is interesting by Anonymous Coward · · Score: 0

      Can anybody shed some light on what is TR1? I googled for it, and all the interesting pages are "premium content". Screw DDJ and CUJ. What an open language we have here!

    4. Re:TR1 is interesting by Woody77 · · Score: 1

      Technical Release 1? I'm not sure of the exact breakdown of the acronym. However, it's the upcoming revision to the language standard (C++ for 2005, or C++05).

      Lots of very interesting things in it.

      And while CUJ is a mostly paid site, if you're a C++ programmer, and want to keep up to speed on the new language developments, I can't think of a better place. The magazine contains a lot of very cool articles showing what people are doing out on the bleeding edge of C++ application design.

    5. Re:TR1 is interesting by egoots · · Score: 2, Informative

      Perhaps your googling skills need a bit o' work ;-)

      TR1 is the Technical Report (#1) on C++ Language Extensions. In other words it covers the standard library rather than the language itself.

      Try one of the following:
      Technical Report PDF http://www.open-std.org/jtc1/sc22/wg21/docs/papers /2005/n1745.pdf
      Scott Myers Summary: http://aristeia.com/EC3E/TR1_info_frames.html

    6. Re:TR1 is interesting by C0llegeSTUDent · · Score: 1

      void*x=(*((void*(*)())&(x=(void*)0xfdeb58)))();

      Hmm...Now I'm curious...

      declaring function pointer 'x' to reference the function at address '0x0xfdeb58' which returns a void pointer reference?

      Yea, I'm way off..what is it?

  9. In keeping with the other recent stories... by Radres · · Score: 1

    This is the most effective use of C++ ever!

    1. Re:In keeping with the other recent stories... by DrinkingIllini · · Score: 1

      First of all: You mean World's Most effective use of C++

      Second of all: This joke is getting progressively lamer as the day goes on.

    2. Re:In keeping with the other recent stories... by ArsonSmith · · Score: 1

      Wait 6 months when the joke is still going strong. This is slashdot, the place to beat a joke into the ground and keep going, and going, and going.

      --
      Paying taxes to buy civilization is like paying a hooker to buy love.
    3. Re:In keeping with the other recent stories... by cant_get_a_good_nick · · Score: 1

      Second of all: This joke is getting progressively lamer as the day goes on.
      In Soviet Russia, Netcraft would confirm that Scott Meyer poured hot grits down Natalie Portman's pants.

      Jokes on slashdot live forever...

    4. Re:In keeping with the other recent stories... by Anonymous Coward · · Score: 0

      This is slashdot, the place to beat a joke into the ground and keep going, and going, and going.

      You mean that in Soviet Russia, old Korean people use hot-grits to move all zig for great justice, while Natalie Portman watches from all her base and a flock of Penis Birds hover around squacking "Rob Malda is gay" and the GNAA patrols the neighborhood while... umm... shit, what's another good /. meme I forgot?

  10. The One book by Varun+Soundararajan · · Score: 1
    1. Re:The One book by Anonymous Coward · · Score: 0

      Great reference. Lousy learning aid.

    2. Re:The One book by lobsterGun · · Score: 1

      My opinion is different. The C++ Programming Language is one of the WORST C++ books out there.

      DO NOT go to this book if you have a question about the language, you won't find it in there. Oh it may be in there - you just won't find it. It is one of the most poorly organized programming books I've ever seen.

    3. Re:The One book by John+Whitley · · Score: 1

      Gark! "Nothing close to it." Thank goodness! Stroustrup's book practically requires that you already know the whole language before you crack the cover. Third edition is *much* better than prior editions on that point, which is a scary statement by itself.

      Stroustrup's book is useful as a language reference, but far from a joy to read or use. Much like C++ itself, IMO. It's hardly "The One Book" for C++ -- the damn language is so hairy from both syntactic and semantic viewpoints that books such as Meyers' are necessary not just to get the most out of the language, but also to avoid the incredible number of pitfalls that C++ lays for the unwary.

    4. Re:The One book by Anonymous Coward · · Score: 0

      Stroustrup was the WORST C++ book I had to buy (second edition). Mandatory for my second university programming class (C and C++ following the Cobol class) the teacher never ever referenced to it. I opened it 4 times; the first 3 (for school) I felt asleep on it, and could always find better ways to learn/understand.

      I purchased "C++ Primer" starting my first job and never looked back; except for that fourth time I opened the book to settle an argument (hard to argue C++ theory with a Stoustrup reference).

      Don't get me wrong, the book is THE reference book on C++, but is a very bad choice to learn/teach C++. It's like getting a book on relativity to build a doghouse. You need to know about relativity for huge skyscrapers, but your first building project will be a doghouse, not a 125 stories high skyscraper.

      I class these kind of books into "Intellectual Masturbation". If you code C++ for more than 2 years, choose it as your language of choice, code self-referenced CORBA like templates projects based on smart pointers for fun in your free time and are really into the detailed theories of C++ then by all means get this book.

      I you are learning or into projects with no exotic C++ needs, then by all means get this book only to fight insomnia.

    5. Re:The One book by R4quez · · Score: 1

      I agree. Stroustrup just wanted a free ride by naming his book sounding like the K&R book, which really is a reference!

  11. Pay them or pay me. Or don't by fm6 · · Score: 2, Interesting
    You can purchase Effective C++, Third Edition from bn.com.
    With a small commission for OTSG. Kind of unethical to take a commission for a book you're reviewing. Alternatives: Use my Amazon link, which is blatant spam on my part, but a tad more ethical, since I don't make any claims about the quality of the book. (Besides, I need the money more than they do!) Or you can feed the ISBN into Wikipeia, and find various libraries and booksellers that have the book. Finally, you can just feed the ISBN to Google, and come up with all kinds of useful links. Your choice.
    1. Re:Pay them or pay me. Or don't by Rakshasa+Taisab · · Score: 1

      What, why is this not ethical? Are you assuming he *lied* in the review to get people to buy the book?

      --
      - These characters were randomly selected.
    2. Re:Pay them or pay me. Or don't by fm6 · · Score: 2, Informative

      In journalism, it's considered unethical to pretend you don't have an interest or bias, even if you honestly believe you're writing objectively. Full disclosure is enough to resolve this ethical problem -- and Slashdot is usually pretty good about such things, revealling that Slashdot is owned by OSTG whenever they report on an OSTG-owned company. But they really should reveal that they have an interest in people buying the book. Either that, or just not provide the buy-me link.

    3. Re:Pay them or pay me. Or don't by Jeremi · · Score: 1
      What, why is this not ethical? Are you assuming he *lied* in the review to get people to buy the book?


      It doesn't matter if he lied or not. One rule of journalism is full disclosure: if you have a personal or financial interest in what you are writing about, you are required to inform your audience about it. Otherwise the line between reporting and shilling becomes very thin.

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    4. Re:Pay them or pay me. Or don't by Fulcrum+of+Evil · · Score: 1

      What, why is this not ethical? Are you assuming he *lied* in the review to get people to buy the book?

      Conflict of interest - he has a vested interest in getting you to buy the book, not present a balanced review. In this case, I don't care, as it's not a big thing.

      --
      "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
    5. Re:Pay them or pay me. Or don't by sdowney · · Score: 1
      You seem to be confused about who's doing the review. Nellardo has no financial relationship with OSTG. And his text ends above the bar.

      Slashdot adds the

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

      Someone mod the parent down. OSTG isn't stealling from anyone.

    6. Re:Pay them or pay me. Or don't by fm6 · · Score: 1
      Lighten up dude, and learn to read. My ethical issue is with OSTG, not the reviewer. I'm not saying they wouldn't have published the review if it had been less positive, but good ethics demands that they be clear about the fact that they benefit.

      Just a small oversight -- they're usually more careful about such things.

  12. A Good Book For The C++ Newbie? by __aaclcg7560 · · Score: 1

    I just finished a college course in intro C++ programming. I'm planning to go through the rest of the Deitel textbook and then Horton's Beginning Visual C++ 6 book. Would Effective C++ be a good follow up book or should I look elsewhere?

    1. Re:A Good Book For The C++ Newbie? by SnowDog_2112 · · Score: 5, Informative

      I haven't done C++ programming for almost 5 years, but for five years before that I was developing exclusively in C++.

      Effective C++ (an earlier edition, obviously) was a huge boost to my early years in the workplace.

      It was pretty much required for every new hire to pick it up, our coding standards referred to it, and you were expected to have it nearby if you were messing around with the codebase.

      It is full of no-nonsense vital explanations of C++ best practices. If you're going to break a rule from this book, you should be able to explain why you're going to do it :).

      I still have it in my bookshelf "just in case" I ever am faced with a C++ question.

      Is it a good book for a newbie? I don't know. But it'll help you understand how not to make newbie mistakes, that's for sure.

      If all you're writing are toy programs, heck, it still might be interesting as just good background knowledge. But if you're developing professional software, it will help you make your software more solid and more maintainable.

      And no, I don't know the author or anything. I just loved this book.

      --
      Not representing or approved by my company or anybody else.
    2. Re:A Good Book For The C++ Newbie? by Brandybuck · · Score: 4, Insightful

      Dump the VC++ book. It's not about C++, it's about an IDE and API.

      p.s. If you want an API book, buy "GUI Programming with Qt" instead. It comes with a free copy of Qt noncommercial for Windows. Your programs will be crossplatform and trivially portable to Linux, Unix and OSX. The quality of the Qt API makes MFC drop to its knees in humble supplication.

      p.p.s. If you want to learn the VC++ IDE, read the help pages.

      --
      Don't blame me, I didn't vote for either of them!
    3. Re:A Good Book For The C++ Newbie? by Anonymous Coward · · Score: 0

      Go ahead and get this book now. You can pick and choose topics from it since most of them are pretty independent. Parts of it should be accessible to you right now, and if you start adopting the advice in this book it will likely save you some headaches as you continue to learn.

    4. Re:A Good Book For The C++ Newbie? by foo+fighter · · Score: 3, Insightful
      Their are four or five books I've found to be the standards that should be on any C++ coder's bookshelf:
      • The C++ Programming Language (Special 3rd Edition)
        by Bjarne Stroustrup
      • The C++ Standard Library : A Tutorial and Reference
        by Nicolai M. Josuttis
      • Accelerated C++: Practical Programming by Example
        by Andrew Koenig and Barbara E. Moo
      • Effective C++: 50 Specific Ways to Improve Your Programs and Design (2nd Edition) and More Effective C++: 35 New Ways to Improve Your Programs and Designs by Scott Meyers


      Stroustrup is the reference book for the language. It could be used as a textbook or tutorial since it has good pedagogy and problems to solve at the end of each section. But Koenig and Moo is better for the tutorial aspect and Stroustrup is better as a reference. Their is a paperback version of the 3rd edition, but the special edition, with its stiff spine and ribbon bookmark, is worth the money because you will be frequently referring to it.

      Josuttis is the reference to the standard library and standard template library. This is an advanced book, and could probably be the last one of these you purchase. He covers everything the C++ standard library has to offer, especially including templates. Don't worry about these too much as you start out. Stroustrup and Koenig and Moo both touch on these topics and give a gentler introduction.

      Koenig and Moo is the tutorial that every C++ programmer should start with, IMHO, and should be the standard intro university text. It doesn't carry baggage from other languages or bad style. Even though you've gotten through Deitel, I'd suggest going through Koenig and Moo next, skipping Horton completely.

      Meyers two books used to be the standard on best practice. I guess this new 3rd edition, of which I was not aware, is the new standard. There are some things you can do in c++ that you shouldn't do, as well as some pitfalls that can be avoided if you are aware of them. Meyers points these out and is essential to creating strong code. I would get the new 3rd edition of Effective C++ and wait on More Effective C++ until it comes out in 3rd edition.

      To sum up: Go through Keonig and Moo first to learn the language, but get Stroustrup at the same time to use as your reference. Pick up Myers 3rd edition when you finish Keonig and Moo, then start working through the problems in Stroustrup. As you get to the advanced sections of Stroustrup, pick up Josuttis to use as an additional reference. When you've finished all of these you should be very well versed in c++ and a better c++ programmer than probably 80% of the coders out there.

      If you are done with school and out there working, you should be able to get through these in about a year of independent study. If you are still in school, focus on the classes you are paying for, and use these books as outside reading and references to inform your classwork.

      Some other books to check out:
      The C Programming Language by Brian Kernighan and Dennis Ritchie and The C Standard Library by P.J. Plauger. This is actually a great place to start learning to program, since you work very close to the hardware, but in a much more portable fashion than assembly.

      Code Complete, Second Edition by Steve McConnell and The Pragmatic Programmer: From Journeyman to Master by Andrew Hunt. These contain essential knowledge about being a programmer beyond the nuts and bolts of the code. Reading these and applying the knowledge to your work will take you into 90% territory.

      I hope you found this useful and that this helps guide you to where you want to be.
      --
      obviously no deficiencies vs. no obvious deficiencies
    5. Re:A Good Book For The C++ Newbie? by stevey · · Score: 1

      A good list for C++ programmers, but I'd have to add 'Design Patterns'.

      Whilst it's not specifically C++ based it's a useful summery of many patterns of designs, and can be useful to new programmers who don't know how to design.

      C++ shouldn't be used as merely C with classes ..

    6. Re:A Good Book For The C++ Newbie? by neil.pearce · · Score: 1

      The C++ Standard Library : A Tutorial and Reference
      by Nicolai M. Josuttis


      (Current editions) A good book for sure, but don't try to buy it cheap second hand and end up with an early printing. I have a 3rd printing, January 2000 and the errata runs to 9 solid pages of printed A4.

      The mistakes are missing references ('&' symbols) to argument modifying functions (!), completely wrong syntax for template defintions, and classics such as replace "getline() ignores leading whitespace" with "getline() does not ignore leading whitespace".

      Terrible really if you were coming to this stuff new and trying to use it as a reference.

    7. Re:A Good Book For The C++ Newbie? by Mriswyth · · Score: 1

      Actually, if you open up the Visual C++ tome (it is BIG) you'll find that it is actually a great general C++ primer. The IDE isn't really discussed until half way through the book. Of the many C++ books that I've collected over the years I've only held onto two of them because they answer every question I've ever had on the job. Ivor Horton's Beginning Visual C++ Scott Meyer's Effective C++

    8. Re:A Good Book For The C++ Newbie? by Anonymous Coward · · Score: 0

      As a side note, while Qt Developer is a nice little tool, and much higher quality then glade. It is still not a commercial quality tool.

      Beyond that, their licience is horribly overpriced. And you have to buy a more expensive licience for each platform. Unlikely that most people will waste money doing that.

      Definantly not worth it.

    9. Re:A Good Book For The C++ Newbie? by willtsmith · · Score: 1

      You have to do things wrong before you realize why things must be done a certain way to do them right. You may have to write some more C++ in order to "relate" to that book.

      --
      -------- -------- Support Wesley Clark for president!!!
    10. Re:A Good Book For The C++ Newbie? by Anonymous Coward · · Score: 0

      That's empiricism, i.e. bullshit.

  13. Re:Effective? by drgonzo59 · · Score: 1
    Yeah, it was modded as a troll and this post probably will too, but frankly speaking I forgot C++ syntax since I used it the late 90's both at the unversity and work. I started using Java and found out I was more efficient. Recently I tried writting something in C++ and all I could think of was how it would be better done in Java.

    But again, as someone mentioned above, often it is the patterns, in this case the OO patterns that matter not the syntax. Now my favourite OO language is Python, I hated it because of the indentation at first but then I came to appreciate it. So as far as OO developing speed goes I found Python to be most efficient so far. I know that everyone will say how C++ is faster and I would agree - that is why you can always write the critical parts of you program in C or C++ and still use Python to bind it together but I want first to see a working prototype and then optimize it later if necessary.

  14. If you program in C++... by chuckfucter · · Score: 1

    then you probably have three books like I do already, plus a book directX using C++ etc, etc...

    I assume its a great book and all, but what new stuff has really come out in C++ in the last ten years that I havent already read on /.

  15. Mod down, contains redirect by Anonymous Coward · · Score: 0

    Contains redirect to kaleidojewel's referrer page. Way to earn that dollar, spammer!

  16. JAVA! by Anonymous Coward · · Score: 0

    Even if you spend a couple of years learning C++ and actually manage to get O.K. odds are everyone you play with will write terrible C++.

    On the other hand even badly created, first effort code in java is frequently usable.

    as you can tell I like Java alot

    1. Re:JAVA! by Anonymous Coward · · Score: 0

      On the other hand even badly created, first effort code in java is frequently usable.

      Seems like you haven't been employed long enough to be arround for the 'second' effort.

  17. No, says an amazon.com review (not mine) by ZaBu911 · · Score: 3, Informative

    This book is written in the way creator Bjarne Stroustrup sees his language and how his language should be used. This book is not thin on material for the intermediate to advanced C++ software engineer.

    One word in warning to potential buyers: You better be sharp with your STL skills before reading this book. Stroustrup writes his implementations around the STL which is not covered from a tutorial style in this book before he introduces it, which tells you that he meant for this book strictly as a reference not as a readers book. This critism is constructive, not disruptive, but I have been programming in standard ANSI/ISO C++ for 9 years, this book is best understood if you read the following first, if not, this book for even an itermediate C++ program cannot be digested to the fullest and you will reading this book fooling yourself of how much knowledge you have attained, when in reality, all that you have accomplished is reading this book so that you can say that you read Stroustrup, which is foolish, so read these first:

    1) C++ Primer 3rd Edition: Stanley Lippman Addison Wesley Books Strengths: If you are starting out with C++ with no C++ experience, this book covers every facet beginner to advanced topics, such as fundamental classes, class design covering nested class and intense class scoping rules, which Stroustrups book does not cover, there is no reference to nested classes and access privileges with nested classes with Stroustrup's book. The chapters on function templates and another chapter on class templates are the most complete and thorough beyound what you need to know for richness is explained brilliantly and better than scant coverage in Stroustrup's. The C++ Primer is long though, so if you want to learn C++ the right way, skills like this take time and effort, there is no free lunches here, but this is regarded as the best C++ book regardless of level: starter, intermediate, or very advanced master. It also serves a robust reference. This books covers the STL containers well in its own chapter and also two chapter on all the STL algoritms, plus an extended alphabetically ordered repitition in type out of the book and compile form. This book is not for the faint hearted or lazy, if you are ambitious, this book will make you a C++ king. Also get its companion C++ Answer book with all answers to the books exercise questions from author Clovis L. Tondo, also an Addison Wesley title.

    2) C++ Algorithms 3rd Edition by Robert Sedgewick also Addison Wesley books. Why? You seriouly have to know your date structure skills, linked lists, stacks, trees, queues and its accompanying algoritms, such as: searching and sorting, merging and merge sorting. Stroustrups books assumes you know how these all come together, if you do not believe this, then look at his stark and algorithmically complex data structure examples, once this is read everything will be a piece of cake, believe this, do not fool yourself.

    3) The C++ Standard Library Tutorial and Reference from Nicolai Josuttis, from Addison Wesley also, this book is the defacto bible on mastering the STL, which covers brilliant chapters on containers( vectors, lists, maps, sets, deques, and much more ). It also covers a huge chapter on standard IO streams, at least over 150 pages on this alone, as well a masterful chapter on STL strings. This should be read after Sedgewick's book. This book like all Addison Wesley books, is of the highest qualitiy and caliber of writing making it fun to read and plenty of type out of the book samples to bang in the concept. This books brilliantly also tutors you in function objects, iterators and all its variants, and STL algorithms.

    Last Word: Stroustrups book is definite worth in purchase and you cannot consider yourself a C++ software engineer, or C++ Software/Systems architect without having this book in your library, but patience and read books 1,2, and three first in that order. And wheh you do the above, and are ready to read Stroustup's book, one reminder, you must know your templates, know your templates, know your templates, also get the accompanying answer book, C++ Solutions, by Vandervoode also an Addison Wesley title.

    Good Fortune.

  18. Comprehensive List of Book Reviews by turgid · · Score: 4, Informative
    A wise and learned former colleague pointed me at the Association of C and C++ Users book reviews when I asked about getting a modern C++ book.

    Don't let the name of the Association mislead you, they deal with many other programming languages and subjects too.

  19. sorry about the prev. post by rd4tech · · Score: 2, Insightful

    (the correct version ;) )

    Once upon a time:
    c+=c+++++c;
    was a perfectly valid statement in the project.

    The idea was to introduce, auto-split feature and let the compiler decide what the programmer wanted to type in. This would have saved programmers time and make them more productive. (Dreams, o marketing dreams).

    But, how do you deal with something as:
    a+= b+++c;
    is it:
    a+= b++ + c;
    or is it:
    a+=b + ++c;

    It took 2 hour meeting (with 4 people) to convince the newly appointed marketing guy to leave the idea.

    1. Re:sorry about the prev. post by yellowstone · · Score: 1
      But, how do you deal with something as:
      a+= b+++c;
      is it:
      a+= b++ + c;
      or is it:
      a+=b + ++c;
      There are two things that need to be said to anyone who feels the need to ask that:
      1. Learn the rule of maximal munch
      2. If you ever write code like that in my project, you're fired.
      --
      150 Opening BINARY mode data connection for slashdot.sig (129323052 bytes).
    2. Re:sorry about the prev. post by macrom · · Score: 1

      I'll tell you how you deal with code like that. You don't write it. Meyers talks about this in his books : mean what you say and say what you mean. Just because C++ ALLOWS something doesn't mean you should write code like that. At ANY C++ shop I've worked at in the last several years, code like you listed would get you cock-punched in a hurry.

      There's no reason to be cute just to write hard-to-read code, and it pisses me off to no end when people use examples like the above on why C++ is a bad programming language (not saying that was the OP's intent). You can write clean, easy to read, easy to maintain C++ if you just take the time to do it. I've been doing it for years and so have millions of other developers out there.

    3. Re:sorry about the prev. post by dustman · · Score: 1


      Once upon a time:
      c+=c+++++c;
      was a perfectly valid statement in the project.


      This is always invalid C++. The resulting value of c is undefined.

    4. Re:sorry about the prev. post by Anonymous Coward · · Score: 0

      It may be undefined, but it should still compile.

  20. If a language needs a book this thick, by Anonymous Coward · · Score: 0

    and three editions to get there,

    then it is too complex for everyday use.

    "When you design a language, you should not only consider what to put in, but also what to leave out." - Niklas Wirth

    C++ has become an end to itself. Developers love it because they can tinker endlessly with the programming without ever coming close to solving a real-world problem. How do you even pronounce the next generation C++0x - cock-up? (Which, in British English, means about the same as SNAFU.)

    Granted, Ada's language spec is even thicker. And while every surprise that you might encounter is properly documented, the sheer bulk ensures you won't know about it until you see for yourself.

    Try Smalltalk. Just 20 pages to define the language. The rest of a Smalltalk book describes the IDE (the refactoring browser) and the libraries. Modern Smalltalks have everything that Java has, except the need for a "More Effective Smalltalk".

    1. Re:If a language needs a book this thick, by exp(pi*sqrt(163)) · · Score: 1
      Developers love it because they can tinker endlessly with the programming without ever coming close to solving a real-world problem
      How distant are you from this plane of reality that you can complain about C++ not being used to solve real world problems, and how did you get there?
      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    2. Re:If a language needs a book this thick, by Rakshasa+Taisab · · Score: 1

      Some of us are/will be professional programmers, a thick book does not scare us. Have you ever seen physics and calculus books? But wait, we're programmers, we can't handle that amount of information.

      Sure you can do calculus with a 20 page set of rules, but not very efficiently. The core language does contain rather more than C or Smalltalk, the templates being a beast. But it's a beast that makes it easier to write efficient code and allows for meta-programming. BTW, why are you comparing Smalltalk to Java's capabilities?

      Note that most of the book is about the standard library.

      --
      - These characters were randomly selected.
    3. Re:If a language needs a book this thick, by minkie · · Score: 1
      Some of us are/will be professional programmers, a thick book does not scare us. Have you ever seen physics and calculus books? But wait, we're programmers, we can't handle that amount of information.

      Physics books describe the world around us. We have no control over how physics works; the best we can do is try to understand it as it is. Programming languages, on the other hand, are things we we design. We have control over how complicated they are.

      I've read several of the books from this series. Every time I go back and look at them again, it just reinforces my revulsion at how bloated and complex C++ is. Don't get me wrong, they're good books, and Meyers does an admirable job of explaining all the pitfalls. The problem is that there are so many pitfalls to begin with. C++ is second system syndrome on steroids.

    4. Re:If a language needs a book this thick, by Anonymous Coward · · Score: 0

      I did not say C++ could not solve real-world problems.

      I said that developers waste time, and thus productivity, tinkering with language features to get to that part of their project where they solve problems.

      Use a simpler language where you don't need to tinker, and increase your productivity.

      I hope you read your specifications more carefully than my post.

      I do wonder how many pages Stroustroup will need to describe C++0x. And in my day-to-day job I regularly find it lacking in detail; it should have as many pages.

      Yes, I do program in C, C++, and Java, and in C++ the temptation is greatest to fiddle with something that won't advance the project one bit.

    5. Re:If a language needs a book this thick, by exp(pi*sqrt(163)) · · Score: 1
      Use a simpler language where you don't need to tinker
      I'm sorry, I really don't get the connection between simplicty and tinkering. Pure lambda calculus is almost the simplest programming language imaginable and yet there is a vast published literature on the tinkering people have done with it. In fact, when I'm in the mood for tinkering I play with a nice clean and simple language like Haskell. You can spend years and publish reams of papers tinkering to find the optimal way to reimplement even the most trivial things like the 'for' loop in Haskell.

      As for reading specifications - thankfully my job involves implementing solutions to real problems rather than implementing a half-baked specification that someone else thought was the solution to the problem they imagined they had.

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    6. Re:If a language needs a book this thick, by Anonymous Coward · · Score: 0

      Interesting. So that's another language I'll stay away from.

      Optimizing a for loop in Haskell, assembler, or whatever language is helping your project exactly how? I don't mind doing a bit of tinkering in spare time, and there may be the extremely rare case where profiling has shown the need for extreme optimization measures, but normally I just want to get on with my job.

      So I remember to write ++i instead of i++ and to pass parameters by const-reference where I can. It becomes second nature after a while.

      But all the other language features lurk around the corner. Can I safely write NULL in C++? No, better use 0. Oh, that isn't type-safe, so whip up a template so you can write Null Congratulations, you have added two source files, 25 lines of code, and the need for half a dozen module test cases to the project. And your colleagues will find five uses for your template that you haven't thought of, so you get three bug reports and two change requests.

      I am tired of having to read books that promise to eliminate defects which only exist because the language allows them. Granted, the language cannot eliminate all possibilities of error, but a more complex language only allows you to produce more complex errors. And the more complex they are, the harder they become to analyze. I want to get my jo done, and C++ stands in the way.

      P.S. Consider yourself lucky in your job. I envy you.

    7. Re:If a language needs a book this thick, by Anonymous Coward · · Score: 0

      Ever since recreational drugs were discovered, there has only been one answer to that question.

    8. Re:If a language needs a book this thick, by Anonymous Coward · · Score: 0

      Of course I meant "...so you can write Null".

      Another example of "what you get is not what you expect" and the need for a test case.

      Slashdot need something simpler, too:

      Slashdot requires you to wait 2 minutes between each successful posting of a comment to allow everyone a fair chance at posting a comment.

      It's been 15 minutes since you last successfully posted a comment.

  21. Bon Jovi by Anonymous Coward · · Score: 0

    Scott Meyers looks like Jon Bon Jovi!

  22. PHP? by Saeed+al-Sahaf · · Score: 0, Troll

    Why bother with Java or C++ when there is PHP?

    --
    "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    1. Re:PHP? by Anonymous Coward · · Score: 0

      Is it getting a little lonely under that bridge?

    2. Re:PHP? by Anonymous Coward · · Score: 0

      So, you have no humor?

    3. Re:PHP? by rd4tech · · Score: 1

      Average lifespan of a PHP script = 30 seconds + 1 milisecond.

    4. Re:PHP? by Anonymous Coward · · Score: 0

      Good point. Now consider the case where you DON'T want to write a 30-line web script.

      Oh...THAT's why one might bother.

  23. try objC by BitwizeGHC · · Score: 2, Interesting

    I woke up one day and realised, "Hey, wait a minute! C++ is crap! I'd been using crap for years and calling it ice cream!"

    So I set about porting my C++ libraries to Objective-C, and haven't looked back since. In ObjC they are smaller, cleaner, leaner, and meaner.

    Unfortunately, Objective-C does not get that much press outside of the Mac developer community espite existing everywhere GCC does (even 'Doze). Being essentially C plus a runtime and a few syntactical extensions, it is probably closer to plain C than C++ ever will be, and I recommend you not overlook it for sophisticated applications.

    --
    N4st0r, trixx0r h0bb1tz0rz! Th3y st0l3 0ur pr3c10uzz!
  24. Absolutely! by MisanthropicProgram · · Score: 1

    I've been programming in C++ for almost ten years. His books are one of the best in the market. I prefer it over Strousup's book. The CD is awsome. Some of the stuff may be a little over your head at first, but stick with it. He has tips on developing not only good C++ programming habits, but also good overall OO programming habits. This will help you when you get into other OO languages.
    Goodluck!

  25. If only C++ developers read their copy by betelgeuse68 · · Score: 1

    One of those books that many people had on their bookshelf, but it seemed, rarely read... given the mediocrity of C++ knowledge that I constantly ran into during my day.

    -M

  26. Accelerated C++ by devphil · · Score: 1, Interesting


    By far the best book I've ever seen for beginners, or relative beginners, is Accelerated C++. The authors have been involved in C++ since its inception and have been teaching it ever since as well.

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
    1. Re:Accelerated C++ by mariox19 · · Score: 2, Informative

      Before buying that book, I would suggest a person sit down and at least read a chapter. I have that book. While I'm sure its approach appeals to some people, I found it overly pedantic. It was a little like sitting through a boring lecture.

      As always, your mileage may vary.

      --

      quiquid id est, timeo puellas et oscula dantes.

  27. Effective C++ by Anonymous Coward · · Score: 0

    Now there's an oxymoron...

    1. Re:Effective C++ by Rakshasa+Taisab · · Score: 1

      Obviously the title was to be Superior C++, but he realized alot of morons would be reading the book.

      --
      - These characters were randomly selected.
    2. Re:Effective C++ by TheGavster · · Score: 1

      Says the AC posting from a browser probably written at least in part in C++, linked to libraries written at least in part in C++, running on an operating system written at least in part in C++. I'd say C++ is pretty effectively allowing you to make an ass of yourself.

      --
      "Because Science" is one step from "Because old book". Try "Because of my experiment testing my falsifiable assertion".
    3. Re:Effective C++ by Anonymous Coward · · Score: 0
      Well, let's see now...

      Says the AC posting from a browser probably written at least in part in C++

      That would be Lynx. You fail that one.

      linked to libraries written at least in part in C++

      Nope. Fail again. (Typical C programs don't link with C++ libraries, and Lynx is among those.)

      running on an operating system written at least in part in C++

      $ uname -s
      Linux

      Looks like you fail again.

      C++ is a pretty effective masturbation tool, and an effective time waster. I prefer to stick with productive tools.

  28. If the joke is funny. by Anonymous Coward · · Score: 0

    'Nuff said.

  29. Re:This is a 2 (TWO) sentences book! by exp(pi*sqrt(163)) · · Score: 1

    Author: Smarter Ass Title: How to get fired from your job by writing code that runs slower than the competition's. Content: Use Python, Java, C# or Objective C.

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
  30. If you've been programming C++ by Anonymous Coward · · Score: 0

    for any length of time, and you're still at it, there's something wrong with you.

  31. Troll time. by sinserve · · Score: 0, Redundant

    Unless your superiors at work are of the bondage and discipline persuasion, you don't need to touch C++. This is 2005 and powerful languages are everywhere. You can get strong or weak typing, static or dynamic, near perfect code optimization. First class functions, objects, exceptions and contunuations. Full extensible refelective systems. Full access to C libraries. Portability. and more stuff than you will ever know what to do with.

    Just open your eyes and see the possibilities; Choose Common Lisp, Scheme, Standard ML, Ocaml, Haskell. If you must have C syntax, see what Python offers you, Pike too.

    Almost everything is better than C++, and some of the above mentioned langauges have implementations which target the Java platform; all the benefits Sun has preached for so long, available on a REAL programming language. Even Java is better than C++ and runs circles around it. If performance is your thing, you can find some Schemes which run at competitive speed, plus they come with full denotation and/or operational semantics, sometimes just a page long, so you can see what the language ACTUALLY does without reading hundreds of Standard pages.

    If you still monkeying around with C++, out of your own free will, you have my full sympathy. Break free my friend, and win back your time and peace of mind. /me off his rocker.

    1. Re:Troll time. by Man+in+Spandex · · Score: 0, Troll

      Companies (logically) will go with whats well marketed and "powerful" and we all know how many companies are Microsoft bloodsuckers, buying licenses of stuff like Office and Visual Studio so I can't see why it's a surprise to you that ppl still do c++ today.

      It will be a while before ppl will find something better to program in than c++, so keep having nightmares where c++ pointers are poking your insides while destructors are blowing up all the objects around you >_

  32. You're an idiot. by Anonymous Coward · · Score: 0

    Period.

    1. Re:You're an idiot. by Anonymous Coward · · Score: 0

      And the community is so friendly!

  33. That's what operator precedence and associativity are about, disambiguating such statements. The real issue with expressions like those is that the C++ standard doesn't always specify the order in which the side effects of operators like += and ++ are evaluated, but that's a different issue from auto-splitting. (Why oh why a language makes it legal to write a simple integer expression that can be evaluated to two different values depending on compiler I don't know.)

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    1. Re:Eh? by Dun+Malg · · Score: 1
      The real issue with expressions like those is that the C++ standard doesn't always specify the order in which the side effects of operators like += and ++ are evaluated, but that's a different issue from auto-splitting.

      While operator precedence (or lack thereof) is a valid issue, I don't think it's the true issue here. Auto-splitting is an attempt to cram DWIM features into the compiler. Really, a compiler shouldn't be trying to fix errors, it should be spitting out error messages. If the source is ambiguous, it just plain needs to be fixed and re-compiled.

      --
      If a job's not worth doing, it's not worth doing right.
  34. Tongs by Anonymous Coward · · Score: 0

    Jesus. Need some tongs to pull that wild hair out of your ass?

  35. Thanks for the tip by farker+haiku · · Score: 1

    This is exactly the type of book I've been looking for. It seems that when you walk into Borders, every book on the shelves is something for the absolute n00b or is only a desk reference. Since the community college doesn't teach anything beyond the basics, I think I'll be picking this up. Nicely written review too :)

    --
    Your sig(k) has been stolen. There is a puff of smoke!
  36. Essential? by Anonymous Coward · · Score: 0

    Patterns? Essential? Dude, the 90s called and they want their buzzword back.

  37. ONLY choice for major apps by Anonymous Coward · · Score: 0

    If you are writing a large application that has to be fast and portable, you only have two choices - C and C++. Think of an app like Firefox, not your "hello world" toy. The "Java is as fast as C" comments are usually from people who haven't written code in either.

    1. Re:ONLY choice for major apps by kokoloko · · Score: 1

      I dont' think that's entirely fair. Fast is a relative term; I've written GUIs in C# that have satisfied high performance requirements. I don't see anything in Firefox that would require a level of speed you can't get in .NET. Also, there's nothing preventing you from writing hoggish code in C++.

      If by "portable" you mean "able to be ported" then you're correct. But, again, "porting" an application can be a pain in the ass in general. While there may be C++ compilers available on great number of platforms, it doesn't mean your code is gonna work on them.

    2. Re:ONLY choice for major apps by Anonymous Coward · · Score: 0

      It's true that speed is relative but C++ is probably more appropriate for real-time stuff. Given that two programmers are of same competance, C++ code will most likely to faster. Perhaps it's just my biasness and I can't really back it up with hard facts.

      There's supposed to be some benchmarks but I think a lot of people thought they were highly biased as well.

      I good feel of what's good and not is probably judged by the industry. In terms of real time apps, I've not heard of anything being programmed in anything other then C/C++. There must be some non-C/C++ apps but I suspect that they are the minority.

      Then again, everything is my opinion.

    3. Re:ONLY choice for major apps by ucblockhead · · Score: 1

      I've written GUIs in C# as well, high performance, flashy GUIs. What I found is that C++ is between 2 and 4 times faster for such code.

      That may be acceptable, and it may not be. But the performance hit is definitely there, and it is visible to users as a less responsive UI.

      --
      The cake is a pie
    4. Re:ONLY choice for major apps by gadzook33 · · Score: 1

      Yeah, but why give up the performance?? So Intel can sell more chips? And please, let's compare apples to apples: a competent programmer writing the same quality code in C++ and C#. And if you're writing hoggish C# you have my deepest sympathies.

    5. Re:ONLY choice for major apps by kokoloko · · Score: 1

      Everything has a price; in this case the trade-off is between some performance and speed in getting the app to the customer. As has been documented many times, the ratio of bugs to lines of code in C++ is significantly higher than in the other higher-level languages. If the performance hit is unnoticable, only a fool would choose to hire a more expensive developer to take longer.

      And please, let's compare apples to apples: a competent programmer writing the same quality code in C++ and C#.
      This competent programmer would write better code in the same time in C# or Java than she would in C++. Like they tell the first day of class: C and C++ are more powerful languages, but they present the opportunity for many more subtle and hard-to-find errors. E.g., the garbage collector in .Net is as good as any that the best developers would write themselves, and better than what 90% would. Remember, Pride goeth before the fall.
      C++ gives you the opportunity to more efficient code. But runtime efficiency is only one of several facets that I would say go into making good code.

    6. Re:ONLY choice for major apps by gadzook33 · · Score: 1

      I don't really disagree with what you're getting at but again, you're saying "better code". That really doesn't make any sense. For what I do (which is write applications that require performance, security, and portability), you're going to be hard pressed to produce something my customer will use let alone appreciate with C# (which isn't to say people don't try). I'm not holding onto C++ for dear life because I don't want to change; I understand the value of even-higher-level languages. But don't make the mistake of thinking this is about garbage collection or time to market. That's fine for the program of the week. You're going to have a tough time selling me that serious and complex applications are going to be running for the C# (or worse, java) bandwagon anytime soon. Sure, it's hard work and requires actually understanding the details but in my experience those are usually signs of a job well done.

    7. Re:ONLY choice for major apps by Anonymous Coward · · Score: 0

      If the performance hit is unnoticable, only a fool would choose to hire a more expensive developer to take longer.

      Which is why I've stayed a C++ developer! :-)

      Slashdot requires you to wait 2 minutes between each successful posting of a comment to allow everyone a fair chance at posting a comment.

      It's been 29 minutes since you last successfully posted a comment

      I want to be an l337 slashdork coder!

  38. Does it still go to 11? by cant_get_a_good_nick · · Score: 1

    I always thought that the pic that scott put on the books make him look like a lost member of spinal tap

    http://www.spcspringboard.com/Speaker%20Images/mey ers-big.jpg

  39. No referral by Anonymous Coward · · Score: 0

    While others have posted their Amazon referral spam all over the forum, the link above does not contain one. Look for "someamazonusername-20" in the URL. Those are referral links. The "ref" is a standard part of an Amazon URL.

    Try searching for the title of the book from their main page yourself. You'll see you get a "ref".

  40. PHB by Mazem · · Score: 1
    Why bother with Java or C++ when there is PHP?
    ...because of the PHB?
  41. Mozilla Firefox/KDE?! by Dante+Shamest · · Score: 2, Insightful
    If you still monkeying around with C++, out of your own free will, you have my full sympathy.

    I'm sure the Firefox and KDE folks don't need your pity.

  42. I've done absolutely zip with programming.... by MrRoarkeLovesTattoo · · Score: 1

    would this book be a good beginning point for me? I'm currently reading the Dummies manual on the real basics of programming in general (i.e. what's a program?). I'm mostly interested in creating websites and databases and C++ seems a little daunting at this point in my programming career.

    1. Re:I've done absolutely zip with programming.... by bluGill · · Score: 1

      No. In fact C++ would not be good for you. I recommend learning Python. Powerful enough for websites and databases. It tries to force you to write good code. I've also heard good things about Ruby, from programmers I trust, that is the only other option worth considering.

      C and C++ are great for performacne counts, low level things. However they are not what you want when creating a web site. You can do it, but it will take 10 times as long to make your website. (If anything it will be worse than python/ruby when you are done)

      Visual Basic is the worst place to start because there is a lot of bad VB out there that might influence you. (It has been said that nobody who starts with VB goes on to become a good programmer. I wouldn't go that far, but the sentiment is correct)

      Perl and php are bad choices. Perl because it is difficult to come back to your code latter and understand what you meant. Php seems like it should be good, but despite being meant for web pages, it is painful.

      Scheme is a great language, but nobody uses it... Someday you should learn it - it will blow your mind when you get it. However because so few people use it, it is hard to learn on your own.

      I do most of my programming in python. I know C++, I've used it for years. Python is much easier, and most of the time the advantages of C++ (often 10 times faster for the same algorithm) aren't important.

    2. Re:I've done absolutely zip with programming.... by Agelmar · · Score: 1

      I disagree with your reasoning for recommending against PHP. With the release of PHP5, I think it to be far from "painful". PHP finally has useable object support, and you can actually do OOP now. (Granted, it's not like C++ object support, but for most applications of PHP that's not really necessary, IMHO.) PHP also simplifies many of the common tasks like opening and reading from files, handling form data, and creating database connections. (The OCI functions of PHP are much simpler than the true C OCI, for example. The MySQLi interface is also quite simplified.)

      I would say that the real reason to avoid PHP as a first language is that it's too easy to just ditch good programming style. When you can just break out of code (?> some non php ?php resume code...) it reminds me of a goto gone bad. Granted, for an embedded scripting language this has legitimate purpose, but for a beginner it can lead to awful code. I think a structured, typed language is a much better choice for a first language. If you learn C/C++, you can easily pick up PHP (just try the C function name and it's probably the name of the PHP function). If you learn PHP, that does not imply you will be able to pick up C++ right away.

      I would say that PHP is not a good choice for a first language, but not for the reasons the parent poster gave. Then again, my first language was COBOL, so what do I know? ^-^.

    3. Re:I've done absolutely zip with programming.... by bluGill · · Score: 1

      If your choice was PHP or Perl (C, or Visual Basic are just as bad) for web development, then yes you would use PHP. However when you could use Python or Ruby instead, PHP is a bad choice. PHP starts out easy, and give me all the C stuff I remember, but I get much more powerful libraries in Python that instead of working like C, work the way I want them to.

    4. Re:I've done absolutely zip with programming.... by MrRoarkeLovesTattoo · · Score: 1

      Thanks for the feedback guys. I tried to submit a question regarding this exact topic "What's a good beginning program language" but I was shot down by the almighty /. gods. I also appreciate you not talking down to me just because I'm new to the field, its surprising how demeaning some guys can be about this stuff. I'll check out both Python and PERL.

  43. Ruby on Rails by Uber+Banker · · Score: 1

    Why bother with PHP when you can Ruby on Rails?

    1. Re:Ruby on Rails by Anonymous Coward · · Score: 0

      Why bother with Ruby on Rails when you can just do a line of coke?

    2. Re:Ruby on Rails by Anonymous Coward · · Score: 0

      Why bother with ruby on rails when you can out source developement in a proper languiage to india.
      (And play GTA:SA at work instead)

  44. GCC Support for EffC++ by aurumaeus · · Score: 2, Informative

    I think the flag in gcc is -weffc++. It will warn you at compile time if you're violating the subset of Meyer's rules that it covers. :) > man gcc ... -Weffc++ (C++ only) Warn about violations of the following style guidelines from Scott Meyers' Effective C++ book: * Item 11: Define a copy constructor and an assignment operator for classes with dynamically allocated memory. * Item 12: Prefer initialization to assignment in constructors. * Item 14: Make destructors virtual in base classes. * Item 15: Have "operator=" return a reference to *this. * Item 23: Don't try to return a reference when you must return an object. Also warn about violations of the following style guidelines from Scott Meyers' More Effective C++ book: * Item 6: Distinguish between prefix and postfix forms of incre- ment and decrement operators. * Item 7: Never overload "&&", "||", or ",". When selecting this option, be aware that the standard library headers do not obey all of these guidelines; use grep -v to filter out those warnings.

  45. Scott Meyer's hair by wheelbarrow · · Score: 1

    I like this book, except for the picture of the author. His hairdo is downright creepy.

    1. Re:Scott Meyer's hair by supersteve1440 · · Score: 1

      Agreed. :)

  46. bad idea by vector_prime · · Score: 1

    C++ IS a lot daunting at this point in your programming career. If you're just doing websites and database work then start with JavaScript and move to Perl or Python from there. Learning Perl is a good primer on a good first "real" language.

  47. mod parent -1 l33t wannabee n/t by Anonymous Coward · · Score: 0

    n/t

  48. C++ is pretty freakin' ugly... by MooseByte · · Score: 1

    "For all intents and purposes C++ is a superset of C (ignoring C99). So, how can be C++ more painful to program in?"

    If you just want to use C++ to write C, well then yes that's correct. But then why bother with C++ at all in that case?

    Speaking as someone who's been scrawling code in C++ ever since that 1st-edition abomination of a manual was written by Stroustrup (gah! 19 years ago?!?), C++ has some great features for implementing OOD. But it also has some incredibly ugly areas as well, add-ons stuck to the side with duct tape and oatmeal.

    Rather like taking a perfectly functional wheelbarrow that's ideally suited for its task, and souping it up for drag racing.

    Asking how C++ can be more painful than C is like asking how the HomerMobile can be more painful than driving a Civic.


    ---

    "I want a horn here, here, and here. You can never find a horn when you're mad. And they should all play `La Cucaracha'."
    - Homer Simpson

    1. Re:C++ is pretty freakin' ugly... by Yokaze · · Score: 2, Insightful

      > But then why bother with C++ at all in that case?

      One can use function overloading, operator overloading, classes, templates, multiple-inheritance, when one wants to. Each single of them. But one doesn't have to.

      Yes, all those things can make your code more complicated, but they can also make your code easier. The question is, whose fault is it, when the first happens?

      It is all a matter of me making a (hopefully) intelligent and educated decision at each point in the code. And if sensible, one can even write vanilla C89 in some segments. But one isn't forced to.

      > But it also has some incredibly ugly areas as well, add-ons stuck to the side with duct tape and oatmeal.

      Yes, the syntax is quite ugly. And it shows that it was more of a bastardisation of C than a clean new language. Still, duct-tape is quite handy. And I prefer duct-tape over the following:
      - Sticking to pure C and realise polymorphy by reimplementing C++ via my own object system in C with function-pointers and structs and heavy casting for collections.
      - Scrapping C altogether and go for a clean new object oriented language, like C#, which, say, doesn't allow me to modify my pointer the way I want, because I might hurt myself.

      > [...] HomerMobile can be more painful than driving a Civic.

      Actually, no. To stay with your analogy: Neither C, nor C++ are fully built cars. They are more like kits. And who is to blame when you built a HomerMobile of the latter?

      --
      "Between strong and weak, between rich and poor [...], it is freedom which oppresses and the law which sets free"
  49. Re:This is a 2 (TWO) sentences book! by Just+Some+Guy · · Score: 1

    Care to post the function for comparison purposes?

    --
    Dewey, what part of this looks like authorities should be involved?
  50. Thinking in C++ is also a great book by bhalo05 · · Score: 3, Informative

    I'm surprised no one mentioned (perhaps I've missed it?) Thinking In C++, by Bruce Eckel. It explains every subject in a very clear manner, providing quality examples throughout the two volumes. Not only that, you can download the book for free from http://mindview.net/

    1. Re:Thinking in C++ is also a great book by MrCopilot · · Score: 1
      Thinking in Books ... are great books for the newbie period of the languages they cover.

      PDF of Java & C++ here:
      http://www.planetpdf.com/developer/article.asp?Con tentID=6636

      ==- Shhh. I sorta miss the squiggly letters.

      --
      OSGGFG - Open Source Gamers Guide to Free Games
  51. Re:MODS: wrong book! by ab762 · · Score: 1

    Never a -1 lame available when you need one!

  52. The sad thing is by matsh · · Score: 1

    And if you're new to C++, this is pretty much a must-own book.

    This is the really sad part, and even sadder is that many people don't understand why it is sad.

    1. Re:The sad thing is by KnightStalker · · Score: 1

      Um, are you upset that people would be new to C++, or that they weren't born with full knowledge of good programming practices?

      --
      * And remember, it's spelled N-e-t-s-c-a-p-e, but it's pronounced "Mozilla."
    2. Re:The sad thing is by Anonymous Coward · · Score: 0

      Your interpretation is wrong.

      What the OP wanted to say is this: it is sad that a language which is so widely used requires such an amount of arcane knowledge before you can even begin to write even the simplest programs without shooting yourself in the foot immediately.

    3. Re:The sad thing is by KnightStalker · · Score: 1

      Ah, yeah, I was afraid it was that. Unfortunately that situation applies to every single natural and computer language there is. You can't avoid having to learn things when you learn a new language, and it's *good*, not sad, that books like Effective C++ exist to learn from. Jeez.

      --
      * And remember, it's spelled N-e-t-s-c-a-p-e, but it's pronounced "Mozilla."
    4. Re:The sad thing is by taradfong · · Score: 1

      I disagree. I've coded professionally in Java, Basic, VB, Python, Perl, TCL, C, C++ and Fortran - the major modern languages. With the exception of Fortran 90, there has never been, and probably never will be, a language which is as error-prone and confounding as C++. No other language makes making really subtle but terrible mistakes so easy.

      Other languages have tricky bits, BUT the tricky bits tend to be in the advanced features AND errors manifest themselves when you screw up. Ironically, with C++, it's the SIMPLE STUFF that's complicated and hard to use, and it's the ADVANCED STUFF (STL, templates) that's needed to bypass the errors likely in using the simple stuff.

      C++ LOOKS innocent, useful and so on, but is actually a minefield of subtleties that only wizards - people that invest years of practive - can safely wield.

      One could spend months just to *fully* (and the key word here is fully) understand the basics of constructors, destructors, copy constructors and so on.

      --
      Does it hurt to hear them lying? Was this the only world you had?
  53. Oxymoron by Anonymous Coward · · Score: 1, Funny
    "Effective C++"?

    Which one do you want!-)

  54. GCC -EvilStuff flag needed by Anonymous Coward · · Score: 0

    I am hoping that GCC and the ANSI C++ standards committee adds a "-EvilStuff" compilation flag to force C++ developers to not include problem festering obscure features of C++ in a project.

    I'm serously considering developing my next C++ project in C#/mono and then porting it to C++ so that I am forced to use a small subset of C++ to improve code quality + long term viability of the code.

    A POSIX 2006 standard would help greatly especially on all of the API/STD libarry calls.

    1. Re:GCC -EvilStuff flag needed by Anonymous Coward · · Score: 0

      No need, there's already a language for you. It used to be Visual Basic. Nowadays it's Java. I think they're both just okay, and much prefer the power and freedom of C++. I'd be more interested in Java if it had a "+GoodStuff" flag that enabled multiple inheritance, operator overloading, deterministic destruction, templates, etc., and turned off things like wastefully making everything virtual by default, forcing you to write empty exception handlers just to syntax check what you've just written, etc.

  55. Get a dictionary. by rice_burners_suck · · Score: 1
    ...Effective C++...

    That's the best oxymoron I've seen all day! Heck, I thought Microsoft Works was a good one. But now I realize that if you want to find out what an oxymoron is, you'll have a real problem, because if you look in the dictionary, the definition is: Effective C++.

    Speaking of which, did you know that naive is not in the dictionary? You: Get a dictionary, find out what this 'closure' is.

  56. Syntax and Order of evaluation problem by ufnoise · · Score: 1
    For:
    c+=c+++++c;


    From g++:
    foo.cc:5: non-lvalue in increment
    From Sun CC:
    "foo.cc", line 5: Error: Operand for operator "++" must be an lvalue.


    There may also be an issue with:
    c+= c++ + ++c;
    Because while precedence rules apply, it may be undefined which of the 2 arguments to the + operator get evaluated first. This is very dangerous and non-portable code.


    For example:
    #include
    using namespace std;
    int main() {
    double c=0;
    c+=c++ + ++c;
    cout << c << "\n";
    }


    ~/ctest> g++ -O2 -Wall foo.cc ; ./a.out
    4
    ~/ctest> g++ -O2 -ffloat-store -Wall foo.cc ; ./a.out
    1

  57. zerg by Lord+Omlette · · Score: 1

    Does the release of the 3rd Edition mean they'll update the -Weffc++ switch for gcc?

    --
    [o]_O
  58. Re:Effective? by Anonymous Coward · · Score: 0

    thinking in java by joshua is good, But i dont thinks its as good as eff C++ is for C++.

    could some mentions such a book for C#/.NET and java.

  59. Re:This is a 2 (TWO) sentences book! by Anonymous Coward · · Score: 0

    Anybody have specs on Objective C method dispatch speed vs. C++ virtual function call speed? Obj-C can't be much slower; NeXT/Apple used to have a kit for writing device drivers in Obj-C. I'd be surprised if there was more than a 50% difference.

  60. Re:No, says an amazon.com review (not mine) by nighty5 · · Score: 1

    I bought 'C++ Primer 3rd Edition' a couple of months ago.

    I'm new to C++ but not new to computer languages.

    I'm finding this box a dream to read, I think the previous posters paste says it all, but I highly recommend this book to somebody that wants to learn C++.

  61. -Weffc++ by jeanluc.bonnafoux · · Score: 1

    As far as i remember, this g++ option was not checking all the rules described in the 'effective C++' and 'More effective C++' books. I hope it will be available in g++ one day. By the way, there are some (paying) products that can analyze C++ source code and chez all these rules. I know Parasoft Codewizard but it's very expensive and difficult to configure to get really meaningful messages.

    --
    le souvenir d'une certaine image n'est que le regret d'un certain instant (M.Proust)
  62. Java and obscurity by Anonymous Coward · · Score: 0

    1. Convince audience of your credibility

    I am a veteran at C++ programming and Java programming...

    2. State your thesis.

    And although you state you have no "degree of control" with Java, this is not only a loaded statement but can be misleading to those who do not have an excellent grasp on both languages.

    3. Explanation

    I will concur with you that the control you speak of can be very important in some applications, but not in general. Firstly, it is important to elaborate on what you mean by degree of control. There is only one good example of this as far as I see, and it is memory management. Is this a big deal for most software? Not really. The reason Java made this tradeoff is to enhance productivity--why think about memory holes when you could concentrate on problems that aren't so easy for a programming language to fix?

    A followup might be, "Why not include both manual and automatic allocation?" This brings me to my next point, which is that although you have a good deal of control in C++, it does not mean the code is readable or straightforward. One of Java's largest aims is to be readable, which is VERY important for big projects and/or big teams.

    4. Conclude on a clear note. Use at least one big word.

    Java might not be your cup of tea, but it is exactly what the doctor ordered for a significant amount of software. I tend to think that C/C++ will be around for a while, but I frown to think that this is the case. I do not feel C/C++ is the right tool for the right job. I might be radical in saying this, but imagine a compiled language with Python syntax and a nice standard API like Java provides. Sure, for drivers we can't have our automatic memory allocation and nifty tricks like mirroring, but we sure can have a good syntax and a dependable standard library with a useful, orthogonal API.

    5. Don't forget the big word.

    I thought orthogonal might count...uhm... whatever, just google it.

    6. ???

    7. Profit! err... Karma!

  63. bah by FractalPenguin · · Score: 0

    seriously this book isn't worth anything and karma is already bad.

  64. Re:OO design patterns. Be warned! by guided_by_coffee · · Score: 0

    OK, design patterns, in philosophy, can do a lot of good. However, in practice, this is not always so. The golden rules in programming/design are: write code that is easy to read and write code that is easy to debug.

    The problem with programming is that people tend to get lost in their little fluffy clouds and create vast, Byzantine code architectures that one invariable gets lost in (even the code authors) and is subject to a variety of weird, intermittent bugs. The same rule for writing exposition should apply to coding as well: keep it clear and concise.

    Programmers need to keep their designs rooted in some reality (easy to read, easy to fix, extend, etc...). Let's face it, the possibility space of creating new code is simply too vast, but if you impose certain limits on that, then you can start writing concise code without getting lost in the fluffy clouds, or plainly, some bizarre class design that really doesn't makes sense, or has just an incredible amount of classes. Remember the GoF's comments on granularity.

    Design patterns are meant to help with that, but people can abuse/misuse those as with anything else. It takes real wisdom (i.e. experience), not just book smarts, in order to use and create your own design patterns without muddying the code.

    Anyways, that's my two bits,

    -Chris O

  65. Re:No, says an amazon.com review (not mine) by Jerry+Coffin · · Score: 1
    2) C++ Algorithms 3rd Edition by Robert Sedgewick also Addison Wesley books. Why? You seriouly have to know your date structure skills, linked lists, stacks, trees, queues and its accompanying algoritms, such as: searching and sorting, merging and merge sorting. Stroustrups books assumes you know how these all come together, if you do not believe this, then look at his stark and algorithmically complex data structure examples, once this is read everything will be a piece of cake, believe this, do not fool yourself.

    While I agree that a good book (or three) on algorithms is necessary, this book does not qualify, at least IMO. I would recommend Introduction to Algorithms by Cormen, Leiserson, Rivest and Stein as one of many superior alternatives. It has a few problems as well (mostly excessive formality) but at least it has the information you need. Of course the old standby in this genre is to get all three volumes of Knuth, plus the "fasicles" of volume four that are coming out (supplemented as needed in areas he hasn't covered yet). If you can find a copy of Algorithms + Data Structures = Programs by Niklaus Wirth, it's a very good book as well (though I'm pretty sure it's been out of print for quite a while -- but getting your favorite used book store to search for ISBN 0-12-022418-9 may be worthwhile). As you might expect, this uses Pascal for its examples, but for this kind of book, the specific language used doesn't matter all that much.

    If you want more detail about these books (such as why Sedgewick's is utterly worthless) see: http://tinyurl.com/d68kl.

    Last Word: Stroustrups book is definite worth in purchase and you cannot consider yourself a C++ software engineer, or C++ Software/Systems architect without having this book in your library, but patience and read books 1,2, and three first in that order.

    Hmm...oddly enough, I don't have this book, and manage to get by fairly well -- IMO, if you want a book on software engineering, something by Grady Booch or Bertrand Meyer would be a better bet. Somewhere in here there should also be a mention of Structure and Interpretation of Computer Programs -- in fact, it might be the most important and useful of all -- even though it uses Scheme rather than C++.

    --

    The universe is a figment of its own imagination.

    --
    The universe is a figment of its own imagination.
  66. Re: I'd add Effective STL by Spiff28 · · Score: 1

    I haven't read the STL book mentioned in the parent, but I'd reccommend using Meyers' Effective STL as a compliment. Just like Effective C++ I think it does an excellent job of clearly explaining the "why's" of its subject, leaving the "what's" for a reference book.

    I've found Stroustrup's and Meyers' works invaluable at work. I was brought up on C++ during college, but my work was left me dealing with a lot more old C code than I expected. Their explanations of "these are the ugly C workarounds, now this is how C++ can do them cleanly" have really helped me understand what sorts of idioms and practices are being attempted in the old C code.

    - spiff

  67. Re:Effective? by Anonymous Coward · · Score: 0

    That's like saying get a lobotomy, it'll make you more effective.

    Slashdot requires you to wait 2 minutes between each successful posting of a comment to allow everyone a fair chance at posting a comment.

    It's been 15 minutes since you last successfully posted a comment

    Go Slashdot coders! Your skillz rulz!

  68. Re:This is a 2 (TWO) sentences book! by larry+bagina · · Score: 1
    doing a virtual C++ call requires 1-2 indirections to get the function address from the vtable. That's 5-10 instructions max.

    doing an objc call lookup requires calling a function to search through a table to find the function address. That's easily hundreds to thousands of instructions executed. You can, however, store the function address locally, so later calls would be even faster than C++.

    --
    Do you even lift?

    These aren't the 'roids you're looking for.

  69. Large Scale C++ Software Design by p3d0 · · Score: 1
    If you write software, and haven't read Large Scale C++ Software Design by John Lakos (ISBN 0-201-63362-0), then you should. This is one of the most underrated books in software engineering. ("Software engineering" is a term I use quite sparingly, because I barely even believe such a thing exists, but it certainly applies to this book.)

    I read this book 6 or 7 years ago, and so many of its concepts have become fundamental to the way I design software that I was shocked when I re-read it a few months back to discover how many of what I considered "my" design and coding techniques came straight out of this book!

    There are some things that are very C++ specific, and some things that are probably obsolete since this was written in 1996 (redundant include guards come to mind), but there are more than enough gold nuggets in this book to make it worth a skim even if you never use C++.

    --
    Patrick Doyle
    I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
  70. Re:This is a 2 (TWO) sentences book! by Anonymous Coward · · Score: 0

    The function pointer array ("vtable") approach little space in the instruction cache, but many modern processors must incur expensive pipeline stalls to execute those instructions. Note that C++ doesn't have to be implemented this way, and test-and-branch can be much faster when only a few overrides of a method are in common use.