C++11/C++14/C++17 Features in WinObjC: A Case Study

In a previous post we talked about the clang-tidy tool to detect where you can use some new C++11/C++14/C++17 features to modernize your C++ source code.  But how we can easily detect where the new C++ features are used in a project?

Facebook and Google use intensively C++11 in their source code. Folly from Facebook as we discovered in a previos post use almost all the C++11 features and I was curious to know if Microsoft also use the new  C++11 standards in their open sourced code.

The Microsoft open source projects could be found in their GitHub repository, some of them are only forks from other projects to adapt them to their needs like LLVM, Clang and OpenCV and others are developed by them. Let’s take a look in one of their projects and discover if the C++11 is adopted and the best choice could be their latest open sourced C/C++ project:WinObjc.

Windows Bridge for iOS (also referred to as WinObjC) is a Microsoft open source project that provides an Objective-C development environment for Visual Studio/Windows. In addition, WinObjC provides support for iOS API compatibility.

A first solution to check where C++11 were used is to explore each source file which could take hours or maybe days depending on the size of the project. Another solution is to use Clang.

Clang and its powerful diagnostic engine to the rescue.

The clang team aims to provide as clear and expressive error messages as possible. They try to make it as user friendly as they can for a command line compiler. To do so, clang should pinpoint exactly what is wrong in the code. This is done through a diagnostics engine which processes the error information into a user friendly message.

Clang emits many kind of diagnostics and for our needs the more interested ones has a description like this: “XXX incompatible with C++98″

But how we can get the Clang Diagnostics for a Visual Studio solution?

The first alternative is to compile your projects using Clang, however it’s not an easy task, indeed you have to modify your build process to use Clang instead of the microsoft compiler.

The second alternative is to analyze your visual studio projects using CppDepend which uses Clang as front end parser, and report all its diagnostics. CppDepend is free for the open source community.

And here’s the result of all clang diagnostics for the WinObjc solution


But in our case we need only the diagnostics of kind “incompatible with C++98″, you can easily filter the previous request to get only these diagnostics:


As we can observe the nullptr and auto features are used in many places in the source code, but unlike Facebook and Google projects the C++11 features are not widely used. And when exploring the C++ source files of WinObjC, we can remark that they use more the C++/CX extensions.


The new C++ standards become more used these days due to the big work of the C++ community. Many new features are very easy to use and it’s recommended to modernize your C++ code to makes it easy to read and maintain.