Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I used to write C++ extensively between 8 and 10 years ago. I have since moved on to C# for professional reasons. However, from time to time I see statements like

"If you're still manually tracking pointer references, you're doing it wrong"

or

"C++ is perfectly safe as long as you're using modern concepts like RAII and not manually allocating memory like a recovering C developer."

Both of those were standard procedure a decade ago. I have seen that C++ has been improved considerably in recent times; C++ 0x in particular seems like it has some new capabilities. What's the best resource for a "C/old C++" programmer to get caught up on "modern" C++ patterns and practices?

share|improve this question
3  
They were standard procedure a decade ago. Unfortunately, there is still a very significant portion of C++ devs using the standard procedure from three decades ago. –  DeadMG May 9 '12 at 19:25
7  
I don't know of a single resource, but modern C++ basically comes down to: (1) extensive use of the STL whenever possible instead of hand-rolled algorithms, (2) usage of smart pointers and STL containers over manual allocation/deallocation, (3) a functional-esque programming style using functors/lambdas along with higher-order functions, and (4) a preference for template-based static polymorphism over runtime virtual functions whenever feasible –  Charles Salvia May 9 '12 at 20:30
    
Effective C++ by Scott Meyers –  Gary Buyn May 9 '12 at 22:40

2 Answers 2

It may have more to do with the instructional materials than most other things, but 8-10 years ago it seems to me that the way the language was used differed a great deal to today. The focus today is more on leveraging templates, type safety, and generic programming where before there was more fear of all that and people focused almost exclusively on the C with objects aspects.

Instructional materials are changing too. While before the standard C++ beginning book would take you through printf, scanf, etc...you hardly even see these in books with a modern approach.

Some good books are any of the red books. Exceptional C++, More Exceptional C++, C++ Template Metaprogramming, Modern C++ Design, Accelerated C++...

I think looking at where I currently work may be a good example. I came here using C++ in a modern way and it seems that most developers don't even know what I'm doing or why. Making objects with operator () in them for example... Had to comment the hell out of every occurence of bind() and eventually was told to scrap all that code. The don't know what initializers do... It's been really freaky and hard for me actually.

share|improve this answer

To get a quick oversight of modern features presented quite well, you'd not go wrong viewing Herb Sutter's recent presentation, "Writing modern C++ code: how C++ has evolved over the years" of C++ features at //build/.

He talks about why its a better language than C# (of course - Microsoft changes its trousers regularly, and today they're wearing the C++ fashion so they will hype this up, just lke they hyped up C# as the answer to world hunger a decade ago) but in doing so he does describe all the good bits (like 'automatic' memory management and the STL classes) and then goes on to talk about the new bits from the C++0x standard.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.