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.

35 of 296 comments (clear)

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

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

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

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

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

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

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

  11. 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.
  12. 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.
  13. 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!
  14. 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!
  15. 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!
  16. 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!
  17. 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.
  18. 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.
  19. 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.

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

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

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

  23. 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
  24. 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/

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

  26. 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"
  27. 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.*

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

  29. 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!
  30. 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.