tags:

views:

140

answers:

6

Some background: My job involves maintaining a large multi-threaded multi-process C++ / C# application, and so I'm often tasked with understanding access violations, memory leaks, heap curruption issues and the like.

I quite enjoy this, and I've amassed quite a good understanding of various low level concepts, but the trouble is that I don't program in C++, and aside for the purposes of maintenance I don't really intend to.

What I mean by that is that if I ever need to develop something then at the company I work at the best choice is C# (more developers, other apps also in C# means better interops), so its not that I don't program in C++, it's just that whenever I do program in C++ it will be purely for the purpose of learning C++, and so I want to get the most out of it.

My view is that "Teach yourself C++" books and the like aren't very suitable as they focus too much on getting things done - there are usually many ways of doing things and so they tend to pick one method, so when I'm presented with some code that does things a different way I'm stuffed (e.g. a book teaches MFC, I then get presented with some ATL code and the book hasn't even taught me what ATL and MFC are, let alone how to recognise that what I'm looking at is different!)

I'm really looking for teach yourself C++, with the emphasis on understanding other peoples code.

+1  A: 

The C++ FAQ is a great source of information.

theycallmemorty
A: 

It sounds like you really need a copy of the C++ standard. (ISO/IEC 14882 - available in draft form for free online. the final version costs a few bucks)

Of course, Stroustrup's book would be a good choice too. But in general, focus on material that describes the language, rather than, as you say, "how to get things done".

jalf
+5  A: 

IMHO C++ in particular is a language that you cannot learn by reading a "teach yourself" book, you really need to have several sources and one of these is actually to look at other people's code.

I would recommend reading Effective C++ and More Effective C++ by Scott Meyers to learn some of the pitfalls when programming in C++, it is a good way to learn especially when you are looking at people's code. Another site than can help is gotw as well, some excellent information is there as well.

Anders K.
You might throw Herb Sutter's C++ Coding Standards in the mix, though it may be redundant with some of Meyers advice. The idea is to specifically target dangerous behavior and how to do it right.
Matthieu M.
+1  A: 

Despite others' answers, I don't think your problems will lie mainly with the language. Sure, you can look at the standard or Stroustrup, but these will only teach you language constructs.

Most of what you will have trouble learning, I imagine, will be windows-specific and whateverplatformyouareusing-specific.

Do read stroustrup and other language guides, but be prepared to delve into the docs for the libraries and systems you are using.

San Jacinto
+4  A: 

Since you'll never be creating C++ programs from scratch, I recommend you narrow your vision and just look at the applications you will be supporting, concentrating on the things you do not fully understand and tackling them one-by-one.

I find http://www.parashift.com/c++-faq-lite/ to be a good basic resource for C++. When dealing with specific technologies like MFC or ATL, do some research beforehand on which book(s) will suit you best. My favorite method: a strong coffee, a comfy chair and a pile of candidate books at Barnes & Noble to review. Focused on-line searching will suffice as well.

There are no shortcuts to knowledge and mastery, but by limiting your focus you can save yourself some wasted effort. Generally speaking, the more complex the technology--or the more fundamental the design screw up--the more you need to know to fix it. It's the facts of life!

dapi
A: 

If you're having to maintain C++ code that uses MFC and/or ATL to a large degree then the best way to learn how it works so that you are able to properly maintain the code is to write small applications that use MFC and/or ATL so that you get an understanding of hwta is going on when the code is run. Reading a book by Stroustrup will not help you in any way to understand MFC and/or ATL. The other thing you should probably be focusing on is how COM works since ATL is basically a framework of templates, macros, etc that makes using COM easier.

Hope that helps.

ChadNC