C++ and STL refresher course [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I know C and C++ quite well. I know in much detail about pointers and well versed with pointer arithmetic and worked on Win32 API and a bit of MFC as well in my university days. In my previous job, I had no chance to look on these matters and worked in some other domain. Now what I want is a crash or refresher course in:
C++
STL
I do not want to go through 500+ pages of books because I know C#, Java, Ruby, Python and even x86 Assembly as well. What I want is to cover advanced and dark corners of C++ and intermediate STL.
Can anyone point out good links about it?
I know about Google! ;-)
But an intelligent human recommendation is something else yet Google has not implemented.

SGI has a pretty nice reference for STL.

As sort of a path to a deeper understanding of the STL you may want to take the time and watch some of the videos at http://www.stepanovpapers.com/. Also "Notes on Programming" http://www.stepanovpapers.com/notes.pdf will also help you understand the "Why" behind the design of the STL.

I'm not quite sure what you mean exactly by advanced C++ and intermediate STL.
The C++ FAQ Lite helped me a lot when I first started with C++.

www.cplusplus.com I like this site a lot

A quick read through of one or more of the 'Effective' books by Meyers and/or the 'Exceptional' books by Sutter would make a nice refresher course. They're short and generally easy reads for someone who's not a novice, but they'll refresh your memory on some of the edge cases you need to know about.

Read STL - C++ feeds on stackoverflow =)
comp.lang.c++
comp.lang.c++.moderated news groups
Herb Sutter's "Guru of the week" - http://gotw.ca/gotw/index.htm
Start learn boost (boost.org), it will be good way to refresh c++ and stl.
C++ Coding Standards : 101 Rules, Guidelines, and Best Practices (C++ in Depth Series) - small and easy for reading in subway book. It helps you refresh your knowledges.
Other books from "C++ in Depth Series" nice too.

For me, the best book on the STL is "Generic Programming and the STL" by Matthew H. Austern. It explains the STL very well from a conceptual point of view, rather then being a reference or tutorial on how to use it.

Some YouTube videos to refresh memory:
STL vector part 1
STL list part 1

I faced the exact same problem about 4 years ago. Moving from a java role back to c++.
The most useful book I found was "Effective STL" - Scott Meyers. This explains how to use the stl properly once your head gets around this your other C++ knowledge will come flooding back.
If you are struggling or still unsure of all the intricess of c++ after this read "Effective C++" and "More Effective C++" by the same author. All the Effective books are short and concise.
Also I always have Stroustrup's book on my desk, And I dip into it as I need to.

Related

Interview question; what is the main theme of Effective C++? [closed]

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
I was asked the following question at a recent job interview:
What do you think is the main theme / single word that sums up the Effective C++ series from Scott Meyers?
What would be your answer to this question?
In one word it's Advice
My answer would be "I'm not sure, I learned C++ without reading that book."
The two older editions gathered advice especially helpful for people switching from C to C++. Using new/delete instead of malloc()/free() and OOP was all new back in 1991.
The 3rd edition is more targeting people switching from other languages (Java, C# etc.) to C++. It comes with advice on patterns, templates, exception safety, a much richer standard library, and many other topics people didn't think about in 1991.
Basically, Scott Meyers' goal has always been to write "the best second C++ book to buy" - not something to teach you the language, but to become a real professional. He wanted to list the "50 most important pieces of advice for practicing C++".
Oh, and something we shouldn't forget: He wanted it (and succeeded in doing so) to be a technical book that's fun to read.
Although a very strange question to ask in an interview (considering your candidate might not have read such an excellent book), I would say the main theme of Effective C++ is to take the path of a semi-expert C++ programmer and adjust his/her way of thinking (especially towards the internals of C++) on the path of becoming an expert.
One thing I learned a lot about is self checking of references (Page 71, Item 17). Better memory management. Preferring new/delete vs malloc and free (which is obvious but his reasonining was very well stated). Another good one was Item 29 on page 123, avoid returning "handles" to internal data.
It is not a simple read, and it is definitely not a beginner's book. It's the next leap for a C++ programmer looking to become a better C++ programmer.
It was a very good book and although it's a little dated it is one of the best books to become a proficient C++ programmer. I still read portions of it to this day, and I'm definitely NOT a C++ expert; it's a hobby.
To impress the person interviewing you mention that although you liked Effective C++ that the interviewer should take a gander at More Effective C++. Explain some of the pros to this book as well and ask he/she if they too have read it considering they've read Effective C++. That should stump the chump :).
That C++ is an insanely complex language with lots of tricks, tips, idioms and odd constructions that you have to know by heart rather than being enforced by good language design?
Probably not going to get you the job at anywhere except MSFT though !
Don't
{blah body too short blah}
C++ gives you enough rope to hang yourself with. However, you can write solid code using it, if you follow these guidelines.
Guidelines to write better C++.
Main (plagiarized) theme: "With great power comes great responsibility"
How to write effective C++?

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.

Math Resources for C/C++ Programmers [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
My degree is in Electrical and Computer Engineering but i'm currently employed as a Software Engineer. I took all of the algebra, geometry and calculus classes that one would expect from someone with my degree however I must admit, I think I learned just enough to pass the test but never really saw a use for it and therefore never really retained much of the material.
Now that i've matured some, I see the use for it all of the time. I KNOW that there are lots of places that math knowledge would improve my coding so i'm ready to relearn the old stuff and learn some new stuff.
What are your favorite resources out there? (Resources that can tie math into programming are even better if you have any!) Books? Websites? Blogs?
I found this blog on the subject intresting:
http://steve-yegge.blogspot.com/2006/03/math-for-programmers.html
also has some recommendations for books.
Wolfram MathWorld is one of my favorite resources for all things math. Wikipedia has plenty of math resources as well.
I think these books will help you on designing algorithms:
Introduction to Algorithms
Concrete Mathematics: A Foundation for Computer Science
Discrete Mathematics and Its Applications
Hacker's Delight is a great little book about math and programming. The blurb:
A collection useful programming advice the author has collected over the years; small algorithms that make the programmer's task easier. At long last, proven short-cuts to mastering difficult aspects of computer programming. Learn to program at a more advanced level than is generally taught in schools and training courses, and much more advanced than can be learned through individual study/experience. An instant cult classic for programmers!
I don't use a lot of "real math", but when I need to remember those formulas that I used in school I go to Google. A lot of the results end up Here
Well, there's always Stack Overflow. :) In all seriousness, if you have a specific question that involves both math and programming, you could do far worse than posting it here.
I favourited a similar Stack Overflow question a few weeks back which contains some good info on the subject:
Essential Math for excelling as a Programmer?
Another poster recommended Numerical Recipes in C++ but posted a link to an older version. The newer Numerical Recipes in C++, 3d ed, ISBN-13: 9780521880688, is available and is an excellent resource.
alt text http://ak.buy.com/db_assets/prod_lrg_images/909/204734909.jpg
Knuth. http://www.amazon.com/Art-Computer-Programming-Volumes-Boxed/dp/0201485419
Or as I like to refer to it: The guy that made me realize I hadn't actually invented or discovered anything that hadn't been known for years.
Alot of the best resources have already been mentioned, but since you specifically called out C++ you should have a look at Numerical Recipes in C++, 3d ed, ISBN-13: 9780521880688.
Also, one of the best mathematics resources on the web is MathsChallenge.net, and its companion site Project Euler.
Math Refresher for Scientists and Engineers (by John R. Fanchi)
Just-In-Time Math for Engineers (by Archibald L. Fripp, Jon B. Fripp and Michael L. Fripp)
I really like the book Mastering Technical Mathematics 3rd Edition. It's kind of a bird's-eye view of mathematics with a technical focus. It starts out with such simple concepts as addition and multiplication, but as it explains the concepts it also explains how computers do the calculations. About half-way through you'll find quadratic equations and calculus. Page 442 begins the discussion of "General Time-Space Hypervolume". I didn't see anything about matrix math in there, but for a good "everything about math in a nutshell"-type book it's great.
I've had this type of experience myself...one of the more comprehensive starting points I found was MIT's OpenCourseWare site. They actually offer their entire Mathematics for Computer Science course materials (and a lot of other course materials for that matter) online, and for free. Here's the link to the Math course:
http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-042JFall-2005/CourseHome/index.htm
It's not the be-all end-all of computer math, but it is a great place to get started, and figure out what other research you may need to gather.