Visual C++ in Visual Studio 2012

Rahul V. Patil

If you have read Jason Zander’s post earlier today, you know that Visual Studio 2012 has been released to the web! Check out the MSDN Subscriber Download Page  and the Visual Studio product website. This release has brought a huge amount of new value for C++ developers. Here are the highlights:

  

C++11 Standards Support

Language Support

  • Range-based for loops. You can write more robust loops that work with arrays, STL containers, and Windows Runtime collections in the form for ( for-range-declaration : expression ).
  • Stateless lambdas, which are blocks of code that begin with an empty lambda introducer [] and capture no local variables, are now implicitly convertible to function pointers as required by the C++11 Standard.
  • Scoped enumerations support. The C++ enum class enum-key is now supported. 

Standard Template Library

  •  We’ve added support for the new STL headers: <atomic>, <chrono>, <condition_variable>, <filesystem>, <future>, <mutex>, <ratio>, and <thread>.
  •  SCARY iterators. As permitted but not required by the C++11 Standard, SCARY iterators have been implemented.

Here is the detailed discussion on C++ 11 features in Visual Studio 2012, with links to the corresponding C++ 11 specs. Please also see the fun video series on STL … by STL.

  

Parallel Programming

Compiler and Linker

We’ve made major investments to help developers make the most of their target hardware. We are introducing the auto-vectorizer to take advantage of SSE2 instructions to make your loops go faster by doing 4 number operations at time, auto-parallelizer to automatically spread your work on many CPUs, and C++ AMP (C++ Accelerated Massive Parallelism) to leverage the power of GPU for data parallel algorithms. Note that C++ AMP also comes with a first-class debugging and profiling support.

Libraries (PPL)

We continue to enhance the breadth and depth of Parallel Patterns Libraries (PPL). In addition to major investments in async programming, we’ve added more to algorithms and concurrent collections. We are also working very hard in bringing most of these concepts into the next revision of the C++ standard.

Debugging

In addition to the Parallel Tasks window and Parallel Stacks window, Visual Studio 2012 offers a new Parallel Watch window so that you can examine the values of an expression across all threads and processes, and perform sorting and filtering on the results.

  

C++ for Windows 8

Note: XAML/DirectX interop :Developers targeting Windows 8 Store apps can use both XAML and DirectX in the same app, which allows developers to build flexible user interfaces like the one in FreshPaint app.

  

IDE

In addition to the general Visual Studio IDE improvements like the new Solution Explorer, Preview Tabs, new Find, Compare, and Asynchronous Solution Load etc., we’ve made several IDE enhancements that are new for C++ and help C++ developers be more productive with Visual Studio.

  • C++ Code Snippets. The IDE now adds the skeleton code for common C++ code constructs like switch, if-else, for loop, etc. automatically. Select a code snippet from the List Members drop-down list to insert it into your code and then fill in the required logic. You can also create your own custom code snippets for use in the editor.
  • Semantic Colorization. C++ code editor now conveys semantic structure of the code by colorizing types, enumerations, macros, and other C++ tokens by default. There are a number of other tokens that can be colorized differently to customize the experience.
  • IntelliSense Enhancements. The List Members drop-down list appears automatically as you type code into the code editor. Results are filtered using a fuzzy search algorithm, so that only relevant members are displayed as you type. C++ IntelliSense Quick Info tooltips now show richer XML documentation comments style information. Selecting a symbol now highlights all instances of the symbol in the current file. Press Ctrl+Shift+Up Arrow or Ctrl+Shift+Down Arrow to move among the highlighted references.

 

  • C++/CLI IntelliSense. C++/CLI now has full IntelliSense support. IntelliSense features such as Quick Info, Parameter Help, List Members, and Auto Completion now work for C++/CLI. In addition, the other IntelliSense and IDE enhancements listed in this document also work for C++/CLI.
  • Visual Studio Templates support. You can now use the Visual Studio Templates technology to author C++ project and item templates

  

Application Lifecycle Management Tools (ALM)

Code Analysis

Static code analysis helps identify runtime issues at compile time when they are much cheaper to fix. Code analysis for C++ feature in Visual Studio 2012 has been enhanced aiming to provide improved user experiences as well as analysis capabilities. In this new version, code analysis has been extended to support 64 bit apps, ship with additional concurrency rules to detect issues like race conditions, and offer the ability for creating customized rule sets. This feature is now available in all Visual Studio editions allowing every developer to make the best use of it.

Architecture Dependency Graphs

Generate dependency graphs from source code to better understand the architecture of your existing apps or code written by others. In Visual Studio 2012 you can generate dependency graphs by binaries, classes, namespaces, and include files for C++ apps. Also, use Architecture Explorer tool window to explore the assets and structure of your solution by looking at solution view or class view.

Image 8267 arch1

Example: Dependency Graph by Binary

Example: Dependency Graph by Include Files

Image 7701 arch3

Use Architecture Explorer to browse assets in the solution

 

Unit Test Framework for C++

Visual Studio 2012 ships with a new unit test framework for native C++. You can write light-weight unit tests for your C++ applications to quickly verify application behaviors. Use the new Test Explorer tool window to discover and manage your tests along with test results. This feature is now available in all Visual Studio editions.

Code Coverage

Code coverage has been updated to dynamically instrument binaries at runtime. This lowers the configuration overhead, provides better performance and enables a smoother user experience. Code coverage feature has also been integrated well with the new C++ unit test framework in Visual Studio 2012 allowing you to collect code-coverage data from unit tests for C++ app by one single click within Visual Studio IDE.

  

 

Coming Soon!

We’ve announced two things that will arrive in a few months:

 

C++ for Windows Phone 8

As soon as the Windows Phone 8 SDK is made available, C++ developers will be able to target Windows Phone. Stay Tuned!

Image 4024 marblemazeonphone

Example: Windows 8 Marble Maze Sample targeting Windows Phone 8

 

As always, we love hearing from you. Thanks for keeping us honest and kudos to those who have influenced our product design for the better!

 

On behalf of the VC++ team,

Rahul V.Patil

Lead Program Manager, C++

 

Posted in C++

0 comments

Discussion is closed.

Feedback usabilla icon