Partager via


Back to C++: From managed to native

The project I’ve been working on for the last several months is using native C++. Since I haven’t employed C++ in a long time (since school, to be precise), I had to “relearn” the language. As expected, the language grew a lot since last I was acquainted with it, and I was impressed with the new features (see Working Draft, Standard for Programming Language C++for more details on the changes). Luckily, my project is a startup, and we are allowed to use the new futures without fears of back interoperability or style consistency. A big help with the learning curve was Visual Studio 2010, which really improves both the coding and debugging experience. I must say, the transition from C# to C++ was much easier because I used the same tools.

Here are some resources I used to get back to native code (as you noticed, I haven’t use the keyword “unmanaged”: a lot of C++ users consider the term “unmanaged” degrading, because it somewhat implies that unmanaged is somewhat inferior to managed or developed after managed code):

  1. Effective C++Scott Meyers
  2. More Effective C++Scott Meyers
  3. Effective STL - Scott Meyers 
  4. Windows via C/C++ (Pro - Developer) - Jeffrey M. Richter
  5. C++ Coding Standards: 101 Rules, Guidelines, and Best Practices - Herb Sutter
  6. C++ Templates: The Complete Guide - David Vandevoorde and Nicolai M. Josuttis

These books helped me refresh my C++ memory. On top of this, I had to get familiar with the new 0x features: lambdas (unnamed function objects), auto (automatic type deduction), static_assert (trigger compiler errors with custom error messages), RValue references (move semantics and perfect forwarding) and decltype. Here are the articles I recommend from the Visual C++ team blog:

  1. https://blogs.msdn.com/b/vcblog/archive/2008/10/28/lambdas-auto-and-static-assert-c-0x-features-in-vc10-part-1.aspx 
  2. https://blogs.msdn.com/b/vcblog/archive/2009/02/03/rvalue-references-c-0x-features-in-vc10-part-2.aspx
  3. https://blogs.msdn.com/b/vcblog/archive/2009/04/22/decltype-c-0x-features-in-vc10-part-3.aspx

Other materials:

  1. Stroustrup C++ language reference
  2. The Design and Evolution of C++ – Stroustrup
  3. The C++ Standard Library: A Tutorial and Reference by Nicolai M. Josuttis.
  4. STL Tutorial and Reference – Musser

As in any process of learning, I made mistakes and I learned from them. Some mistakes were due to faulty expectations coming from the C# world – like C++ scoped static initialization is not thread-safe, on purpose!. I’m still learning, and I’m still making mistakes. In future blogs I will share with you some of these mistakes.

Comments

  • Anonymous
    October 05, 2010
    These are all great resources and books, I'm looking forward to reading your next blogs related to C++ ! It's always good to see Microsoft employees talking about native code :) Welcome back to the native world.

  • Anonymous
    January 19, 2011
    Nice post !  moving back to native coding will do a world of good. Avoid get silo'd into a specific technology space. I am looking to do the same although my current project is still managed