advanced c or c++ book [closed] - c++

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
what is the most advanced c or c++ book you ever read?
i am asking this because i already read lots and lots of books on c and c++ on a lot of topics including (object oriented programming-data structures and algorithms-network programming-parallel programming (MPI-PThreads-OpenMP-Cilk-Cuda)-boost library....). So whats next. I still want to advance.. especially in c.

Scott Meyers:
Effective C++
More Effective C++
Effective STL

Modern C++ Design

(For C) Expert C Programming: Deep C secrets without a doubt.

The C++ Standard. You cannot get any more advanced than this.
Similarly for C, there must be a book on the C99 standard, perhaps this page will help: http://careferencemanual.com/

Modern C++ Design by Andrei Alexandrescu.
Explains a few design patterns in detail, and explains how powerful C++ can be.

My favourite "difficult" C++ book is this Template Metaprogramming one: C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond.

It seems to me there aren't half as many books about C programming as there are about C++. The language just isn't that complex.
One interesting read might be P. J. Plauger The Standard C Library. It is supposed to contain some masterful code. It's on my to-read list.

The ubiquitous Stevens "Advanced Programming in the Unix Environment".

Depending on your definition of advanced, and whether you are focused on the languages themselves or topics is / using those languages (C / C++).
Numerical Recipes in C - not say this is good style usage, just advanced material
Algorithm Design Manual by Steven Skiena
Advanced Compiler Design and Implementation by Muchnick
Optimizing Compilers for Modern Architectures by Allen & Kennedy
Of course a Zen style answer would be to study non-C/C++ languages to learn more about C/C++. Smalltalk, Lisp, Scheme, Haskell, Python, Prolog, or Forth for example of languages from a different programming paradigm, which could expand your approach for development in general.

Alexander Stepanov and Paul McJones, "Elements of Programming".

Large Scale C++ Design by John Lakos.
Practical advice on managing the complexity of compiling/linking and executing large C++ programs. Talks a lot about decoupling and how to avoid the many kinds of dependencies that arise in C++.
(This is something most C#/Java developers, and sadly some C++-devs too, rarely understand.
IMO, it's a pain they need to. I wish we had modules in C++ already.)

The Design and Evolution of C++ by Bjarne.
It's nice to know the history of some features. Makes it much easier to understand why and how stuff works, and thus also easier to remember and explain to others why some things are the way they are.

I am not sure if you would consider these advanced, but I would surely put them in the category of must have references:
The C++ Programming Language Special Edition (3rd) by Bjarne Stroustrup
The C++ Standard Library: A Tutorial and Reference by Nicolai M. Josuttis
The other books I would recommend have already been listed by others.

You really want to test your mental limits? Then try these:
Alexandrescu: Modern C++ Design
Abrahams&Gurtovoy: C++ Template Metaprogramming
These books look deceiptively thin, but they stretch the limits of template programming, your C++ compiler, and your brain.

Hey nobody mentioned about Bruce Eckel's Thinking in C++ Volume 1 And Volume 2. When I read it as the first book it went straight way above my head. However as now I have good experience and have read books like Effective/Exceptional C++ so Eckel's book is now an ordinary stuff. However no doubt its a very popular book (4.5 stars on Amazon - 84 customer reviews).

Exceptional C++ by Herb Sutter.

Related

What C++ tutorial would you recommend for an experienced programmer that has some patchy knowledge about the language? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
In my early days of programming, before I started working professionally, I wrote a fair share of trinket/exercise apps in C++ and felt fairly confident that I know the language. Then, as opportunity came, I went to do real work and left the C/C++ world. For the past 5 years I've written tons of code in C# and have had scarcely any encounters with the C/C++ languages. Now, after spending some time on SO and teh interwebs, I see that what I thought I know as "C++" is actually a mix between C and C++, with large gaps in my knowledge about the more intricate workings of the language. At the same time I also realize that I am intrigued by the language and would like to learn it more.
Googling for "C++ tutorials" reveals a wealth of tutorials, but they are all aimed at complete beginners, spending a lot of time explaining basics that I'm already familiar with. I don't expect that there will be any tutorials made exactly for me, but are there some that have at least been written with an experienced programmer in mind, not spending a lot of time on trivial things, and discussing the finer points of the language and compilers?
C++ is too complex to be learned through tutorials, you could only scratch the surface that way. Especially the advanced usage of the STL (and templates in general) is usually beyond the scope of online tutorials.
Therefore, I would recommend books: Stroustrup's "The C++ Programming Language", and Scott Meyer's "Effective C++", "More effective C++" and "Effective STL".
You can skip the first few chapters of Stroustrup if you feel confident you know that part already, but it's the best book for going into the details of the language. There should be a law for every aspiring C++ programmer to read at least the first two of Meyer's books I mentioned.
Once you're through with that, check out "Modern C++ Design" by Andrei Alexandrescu for a real eye-opener for what templates can be used for.
Update: In reaction to a downvote eight years later (...), be aware of The Definite C++ Books List. My personal recommendations above hold true, but that list is community-driven.
C++ is a very old language so there are lots of good books available. I would recommend to read those books, rather than searching sites and blogs. My personal experience says in harder to find lot of good articles at one place, by most of the good articles are already in books.
Regarding sites:
Dr. Dobb's site and journal have lots of good articles.
Books:
Effective C++
Exceptional C++
C++ Object Model
Bjarne Stroustrup
Beyond the C++ Standard Library
I suggest, though rather as supplement, the C++ FAQ Lite. It has information ranging from basic things to really obscure C++ features and many tips to write good C++ and helped me more than once when some stupid template thing or whatever wouldn't do what I expect.
1.C++ Object model is nice book for professionals.
2.Design and evolution of C++ by bjarne stroustrup give you in-depth insight.
3.Scott Meyers' Effective C++ series is also nice one.
You've gotten a number of good recommendations, but none seems to have included the one that was really written to fit your situation. Accelerated C++ was written for people who already know the basics of programming, and just want to learn how to program in C++.
Workings of the language? What areas exactly do you think are worth improving? I have a slight trouble extracting it from your question.
One book that i always keep on my table and peek into frequently is C++ Primer by Lippman et al, 4th ed., ISBN 0-201-72148-1. This is not a tutorial, this is a reference. Whenever you have a question about the language itself, this is where you can find a short and precise answer.
If you want specifically a tutorial which aims at experienced C programmers, see Bruce Eckel's Thinking in C++. Available as free download on author's site and also printed through Prentice Hall.
At some point you will have learnt a great many things which you CAN do, from then on, you should learn what NOT to do. This is a long and painful part, and i don't have a precise recipy, but accept my sympathies. The deeper you get involved into complex stuff the more likely is it to bite you at some point due to conflicts between language features. I suggest taking a look at Imperfect C++ by Matthew Wilson, C++ Coding Standards by Sutter and Alexandrescu.
You probably want to skip the stuff you already know and move on to harder more fun stuff. I assume you already know a lot about the language and it's syntax, methods, classes, etc.
Where to start? Well, there are very good books and papers on the language. I can recommend many books on the language but you can probably find them using the stackoverflow search.
I can only tell you what you already know. You wont find a book that covers it all. You will have to browse through many books in order to get what you desire. Take a randomly recommended book, browse through it skip the stuff you know and try to fit it all together. Try to make something out of the fresh knowledge by writing some code to understand it better. Do it until you understand it fully.
Here is a brief tutorial for advanced C programmers to refresh your memory on the language.
Essential C++ by Lippman is a small but great book.

Should I read the Exceptional C++ books if I've read the Effective C++ series [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm a practicing C++ programmer (on Unix and gcc 3.x) for the past 6-7 years. I've read Scott Meyer's Effective C++, More Effective C++ and Effective STL cover-to-cover and have lived and practiced his suggestions/techniques along with Boost. I would like to move on to the more advanced aspects of C++ - something along the lines of 'Modern C++ Design' by Andrei Alexandrescu. However, before starting to read this, I am wondering if I should spend time reading Herb Sutter's Exceptional C++ books as well. How would you compare the Effective C++ series with Sutter's books?
Thanks a lot in advance for your response.
Read as much as you can - differing perspectives are always valuable.
Yes, absolutely. Herb Sutter covers a lot of very important, but generally poorly understood areas of the language and provides lots of useful guidance for writing more robust code.
While it's true that much of the material originated on the gotw site, it is expanded and better organized in the books. If you can answer all of the problems correctly then you find that you are very rarely faced with code that you don't understand why it behaves like it does. You may also find yourself heading off many potential problems that you spot in code before they become real issues.
I got a lot more out of the Exceptional C++ books than I did out of Effective C++, but this is going to be a very personal thing.
Frankly, Herb Sutter yanks a lot in the exception safety ever since the introduction of the idea in one of the journals of the pre-2000 age. The fact he used it a lot on replication and transactional systems makes sense, and unless you are a huge follower and interested in only the software of such 'safety' kind you will be bored to death. Meyers is far more practical and engaging.
Besides, if you want to move on, there are other books in the series, notably from the legends and not the writers for the sake of writing. Look up the bits from Nicolai Josuttis (C++ Templates: The Complete Guide), Aleksey Gurtovoy (C++ Template Metaprogramming) and more recently 'Daddy 2' Stepanov. In my opinion, they are more influential, knowledgable, practical and shaping than anything DDJ or exception safety induced writeups...
And of course, if you ever need to go back to basics (and there is always a reason to), one of the best possible books on the subject is by the daddy himself: The C++ Programming Language (most underestimated and skimmed over book out there).
Read The Definitive C++ Book Guide and List. "Exceptional C++" is on the list.
I like the C++ Coding Standard book because it's just that, a coding standard.
Effective C++ introduces important ideas, and was my first read too. C++ Coding Standards however is shaped like a coding standard, which any person programming should have. There are a number of other coding standards available, Sutter's one has the advantage of being concise and well explained (only 100 items very neatly classified).
I would take the time, if I were you, to read the C++ Coding Standards and the Guru of the Week entries before moving on to meta-template programming.
Meta-template programming is interesting. I loved Modern C++ Programming and its approaches. However it is less used in practice I think, strengthen the basics as much as you can, then you can always play around with 'new' ideas.
I would absolutely recommend the Exceptional C++ books if you're looking to move into more advanced C++. My sense from reading both series is that the Effective C++ books tell you how to write code that doesn't completely suck, and the Exceptional C++ books tell you how to write code that's rock-solid and bulletproof. I was less taken with Modern C++ Design; if you want to get into serious template metaprogramming it's pretty much the definitive work, but I found it a little... out there for my taste, particularly where he builds this gloriously complicated template structure that'll bring tears to your eyes with its sheer beauty, and then mentions "Oh yeah, this doesn't actually work on any compiler that's currently available".
I found both books interesting and useful. There are lot of common topics and you might already know them, but certainly it will help.

Resources to learn C++ itself, not the basics of programming? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm something of a new, reluctant convert to C++ from a Pascal, Ruby, and PHP background. I haven't worked with Pascal since a few months of torture with "Delphi Turbo;" since then I've practically been eating and sleeping Ruby and PHP. I'm already well acquainted with object oriented programming and many various subjects.
My main trouble is that I already know the rudiments of C/C++ programming, less the actual experience of working with C++. I worked with C for long enough to realize that even without macros, etc, I didn't want to work with it. (Some of the disgust was from maintaining a CGI application in C, when accustomed to Pascal's automatic string management.) I know just enough C++ to be dangerous to myself and anyone else unwitting enough to use my "code."
I'd really like to work up to a good enough understanding of C++ to use libraries like Crypto++ and Boost without major problems or in-depth knowledge of the language's intricacies. I just need to figure out how to work with C++ without killing myself (either with C++, or with the long-standing dislike that I'm already battling).
What are effective resources that will teach me C++ without assuming that I must be retaught all basic programming? I'd rather not relearn concepts that I already know, unless the paradigm in C++ is significantly different. I'm also learning on my own time, so don't recommend me a book complex enough to need a guru to explain to me, please! And I have an effective budget of $0 for learning C++, so please keep suggestions to quality online resources or books common enough that I could likely find them at the library.
Read Effective C++ by Scott Meyers - it's a good guide for getting past the basics of C++ and showing how to write and use "correct" C++ code
The C++ FAQ Lite is a great resource.
I highly recommend Stroustrup: The C++ Programming Language (Third Edition). As the author of C++ he is the authority on the language, and the book is useful as a reference as much as it is for learning the language. It's common enough that most good general purpose libraries will have a copy. He goes into quite some depth on all the features of C++, including explanations of why certain design decisions were made in the language. Personally, I think this is the best book around for programmers to learn C++.
Once you have a good grip on core C++, David Abrahams and Aleksey Gurtovoy's book, C++ Template Metaprogramming, goes into further depth and provides many examples of how C++'s template system allows you to perform complex compile-time programming, a highly valuable skill these days. This one is a little less common but you can probably find it at a university library.
I can give you a couple of keywords you might want to research in more detail:
RAII (Is pretty much the technique that ensures you don't have to worry about memory leaks. Very convenient)
Generic Programming (The STL in particular. Experiment with iterators and the standard library algorithms, and see just how powerful these abstractions are. They're a key part of what I like about C++)
Functors (Perhaps too simple on their own, but the way they can be used instead of function pointers with the algorithms mentioned above is interesting)
And just get familiar with templates, and "mild" forms of template metaprogramming. (Traits classes, for example, and (partial) specializations.
And just keep an eye on the C++ questions here on SO. A lot of interesting topics are regularly brought up.
But the best advice is probably to keep it completely separate from C. Forget everything you learned about how to use C. It either doesn't apply in C++, or leads to inferior code that is harder to read and maintain.
It's an interesting language in its own right, and has a number of unique features. Leverage those, and it can actually be fun to work with C++. Treat it as an overengineered Java, PHP or C, and it'll just make you want to throw up.
You need to write code. A lot of code in C++. There is no substitute. You also need to read good code.
I agree with the suggestion for Scott Meyers' books though. Those are pretty good.
Part of your learning will be the leap from procedural programming to OO.
I would highly recommend the book "C++ Common Knowledge" by Stephen C. Dewhurst. Don't know if it's common enough to be found at the library (it's not at mine, but my library sucks for computer books that aren't 5-10 years out of date), but it does an excellent job of taking the complex aspects of C++ and making them easy to understand, without dumbing anything down for beginners. Definitely worth the investment.
To quote from the back of the book:
This book is for you if
You're no "dummy," and you need to get quickly up to speed in intermediate to advanced C++
You've had some experience in C++ programming, but reading intermediate and advanced C++ books is slow-going
You've had an introductory C++ course, but you've found that you still can't follow your colleagues when they're describing their C++ designs and code
You're an experienced C or Java programmer, but you don't yet have the experience to develop nuanced C++ code and designs
You're a C++ expert, and you're looking for an alternative to answering the same questions from your less-experienced colleagues over and over again
C++ Common Knowledge covers essential
but commonly misunderstood topics in
C++ programming and design while
filtering out needless complexity in
the discussion of each topic. What
remains is a clear distillation of the
essentials required for production C++
programming, presented in the author's
trademark incisive, engaging style.
Here is a link to a question with answers that should help you.
https://stackoverflow.com/questions/1227764/i-need-to-improve-my-c-skills-fast-is-this-realistically-possible/1227805#1227805
For effective stuff you can find online Cplusplus.com has a pretty good reference and information.
If you can find the book "C++ Common Knowledge" (Stephen Dewhurst) at the library or cheaply online, I would add that to the list posted on the StackOverflow link above as well as "The C++ Programming Language" (Stroustrup). Going through the questions under the C++ tag right here on SO should give you some good pointers and code examples to get you on your way.
Here's a list of good C++ books which teach you C++ rather than basics of programming.
Sit down and write some C++ code.

Is it Wise to Spend Cash on a C++ Book Keeping in View the Upcoming C++0x?

I just purchased C++ GUI Programming with Qt4 and after reading the code samples in this book I'm beginning to realize that my knowledge of C++ is incomplete. I learned C++ two years ago from online tutorials and a couple of ebooks I downloaded, and it turns out none of these resources were good enough. Since then I haven't touched the language and have been using Python instead.
Now I'm thinking of purchasing a good book on C++ that covers advanced topics, and the one I have in mind is Bruce Eckel's Thinking in C++ (both volumes). I know they are available for free on the web, but I really can't stand reading books on a laptop screen.
Since C++0x might be out pretty soon, is it wise to go ahead and spend cash on these books? Will C++0x break backwards compatibility? Volume 2 covers features like multithreading, templates etc. Would any of these features change significantly in C++0x?
I wouldn't hold my breath for C++0x. I doubt it will be out by the end of this decade. Even when it will be out, you should probably count a year or so for compilers to implement it. Learn the fundamentals now, and it should be relatively easy for you to learn most of the new features when the standard is out. The Standards Committee is known for its efforts to maintain backward compatibility.
I personally check with the evolution of the standard from time to time, just out of curiosity. Subscribe to Herb Sutter's blog feed and look for Standard updates.
My personal favourite advanced C++ book is Bjarne Stroustrup's The C++ Programming Language, 3e. It is the one single C++ book from which I think I learnt the most, with respect to language and STL details. Scott Meyers' books helped clarify a lot of things too. Meyers writes in a very readable language (English, I believe), and often what would happen is that I'd read an entire Item from Meyers' book, and then find the same information in Stroustrup's book condensed into a single sentence or so. That is to say Meyers' books are extremely useful in getting your attention to interesting details.
As for the changes I expect for threading, I think there going to be two new libraries for this purpose in the standard. Concepts are an even bigger change coming, and they are somewhat related to templates. Up until now we had concepts in the STL, but these were conventions; an algorithm would make assumptions about a type you pass to a template, and you'd know to pass the correct "type of type" because of the conventions. This implied terribly error messages, the STL template errors we all know and "love". Concepts will help solve these. There are other improvements (complexities) to the language. Herb Sutter talks about them a lot.
It is certainly wise to buy the book. C++1x will hardly break with previous code. Nearly everything you learn is also possible with the next C++, and it will greatly help you understand the need of why C++1x will introduce what feature. For example, why will it have variadic templates, and why those concepts?
Even if the backward compatibility is broken on some features, the biggest part should be still usefull.
Furthermore, the first books on C++Ox might not be the best ones.
I would prefer a very good book on C++ to a book on C++Ox.
I would definitely go for buying the books
Those from Eckel are really good books, and I really recommend them.
It will take several years for compilers to catch up with new features introduced with C++0x (just look how was with template support!)
It will take even more years for projects to start using them
Finally, although I do not know with detail the3 changes introduced with the new release of the language, the C++ committee has always been very conservative on backward compatibility, therefore you should do not have any risk of learning something will be obsolete soon.
I'd echo the recommendation to get the Bjarne Stroustrup book "The C++ Programming Language
(Third Edition and Special Edition)" http://www.research.att.com/~bs/3rd.html in addition to any other book you may be interested in, if you can afford multiple books. If you can afford only one and have mastered the basics (as you have) then I'd probably learn towards the Stroustrup book. You can't go past getting the facts from the man himself.
You can track developments in C++0x here:
http://www.research.att.com/~bs/C++0xFAQ.html
if you are interested. As previously commented, I wouldn't hold my breath if I were you.
You might try a site like Safari Books Online to keep up-to-date with technical and programming books. I've bought several Ruby- and Ruby on Rails-related books in the past and they're now much less useful because the stuff in them is deprecated.

Existing Standard Style and Coding standard documents [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
The following have been proposed for an upcoming C++ project.
C++ Coding Standards, by Sutter and Alexandrescu
JSF Air Vehicle C++ coding standards
The Elements of C++ Style
Effective C++ 3rd Edition, by Scott Meyers
Are there other choices? Or is the list above what be should used on a C++ project?
Some related links
Do you think a software company should impose developers a coding-style?
https://stackoverflow.com/questions/66268/what-is-the-best-cc-coding-style-closed
C++ Coding Standards: 101 Rules, Guidelines, and Best Practices (C++ In-Depth Series)
by Herb Sutter and, Andrei Alexandrescu.
I really think it does not matter which one you adopt, as long as everyone goes along with it. Sometimes that can be hard as it seems that some styles don't agree with peoples tases. I.e. it comes down to arguing about whether prefixing all member variable with m_ is pretty or not.
I have been using and modifying the Geosoft standards for a while, these are for C++. There are some other at the what-is-your-favorite-coding-guidelines-checklist thread
Hmm, strange question. Just choose standard which most of the team members are familiar with. Make some kind of poll for your team. Not sure how SO can help here :)
High Integrity C++ Coding Standard Manual - Version 2.4
Try this one, it's the one that NASA's Goddard space flight centre uses.
http://software.gsfc.nasa.gov/AssetsApproved/PA2.4.1.3.pdf
I've written a coding standard for a major British company and was very conscious of putting reasons why I selected certain things rather than just make it a bunch of "Thou shalt" pronouncements. (-:
As a quick way out, I'd suggest mandating:
Scott Meyers's Effective C++ 3rd Edition (Amazon link) - if you can find a copy of the 1st edition of this book then buy it for the overview of OO design which was removed from later editions. )-:
Scott Meyer's book Effective STL (Amazon link) - you must use STL to use C++ efficiently.
Steve McConnell's book Code Complete 2 (Amazon link) - not C++ specific but full of great insights.
Coding standards are only meaningful if they help you write code. So they just need to keep your code consistent (ie if someone puts m_ for variable members and someone doesn't, it can take longer to grok the code than if they all used the same style).
That's all they (should) do, so just pick up your existing code and make sure your team codes to the same style.
I like to think of it like cartoons. If you become a cartoonist on the Simpsons, you have to draw eyes in the official way or everything looks pants, but if you go to Family Guy, you have to draw them differently. Neither way is wrong.
Too many standards are about meaningless restrictions, written by people who don't code themselves (or consider themselves too good to keep to them). Others try to teach you how to code. Neither has its place in a good standard, those just make it easier for you to look at some code and understand what its doing.
eg. my standards include rules for naming directories - you will always have your code in a directory called the same name as the project, and all binaries go in the bin subdir, with all config files in the same place, and a changelog, etc. All simple stuff, but I guarantee I'll never find a project called something different with its binaries in the root directory where I don't know what changes were made to it. Simple, easy stuff that makes a huge difference.
I agree with Harald Scheirich, it is most important to have the team agree on what the rules should be rather than just picking a set that has been recommended by outsiders.
My personal recommendation would be to read Code Complete, 2nd Edition by Steve McConnell which describes (among a whole lot of other useful stuff) several common coding standards and offers commentary on each. This might help your team in setting up your own standards.
Lockheed Martin's JSF Air Vehicle C++ Coding Standards is an interesting read but it's a bit overkill unless you're working in fields where a bug can kill people. It's still a very important example to look at from a computer ethics standpoint about an example of how to program with safety and correctness being top priority.
For general-purpose C++ coding, I'd personally recommend C++ Coding Standards by Herb Sutter. From the very beginning, it emphasizes what not to standardize (things relating to style or preference rather than practices that promote safety, correctness, efficiency). It's also among the easiest reads in your list giving very brief but concise arguments for each standard, making it something easy to show your co-workers.
Poco C++ Coding Style Guide.pdf
Apple Coding Guidelines for Cocoa
GNU Coding Standards
Bell Labs' Recommended C Style and Coding Standards
reserved names from POSIX / ISO
Facebook HHVM Coding Conventions
GeoSoft C++ Programming Style Guidelines
LLVM Coding Standards
C Style and Coding Standards for SunOS