Software

Microsoft promises Clang for Windows in November Visual C++ update

Improvement in cross-platform code is the aim

By Tim Anderson

14 SHARE

Microsoft will integrate the Clang open source C and C++ compiler with Visual C++ in an update expected in November 2015, according to presentations given at the recent CPPCon 2015 event in Bellevue, near Seattle.

Clang is a C, C++ and Objective-C compiler that generates intermediate code for LLVM, a related open source project, enabling it to target multiple platforms.

It was primarily developed by Apple, but has been open source since 2007, and is also used by Google, Sony and many others.

Visual Studio 2015 already integrates with Clang for Android and iOS development. If you are targeting Android you can choose between the GCC (Gnu C++) or Clang toolsets. Visual C++ iOS projects use a Mac as a remote build server.

The forthcoming Clang integration is different, since it uses Clang to compile Windows applications.

Visual C++ is comprised of several parts, including the Visual Studio IDE, the front-end compiler which generates an AST (Abstract Syntax Tree) representing the content of the program, and a back-end compiler which reads the AST and generates executable code.

The front-end compiler is called C1, and the back-end compiler C2. Two different teams within Microsoft work on C1 and C2.

Microsoft’s new integration uses Clang in place of C1, but continues to use C2 for the back-end. The steps, as presented by back-end leader Jim Radigan, are that Clang will emit LLVM IR (Intermediate Representation), which will then be converted into the intermediate form used by the C2 compiler, described by Radigan as tuples.

Code generation then continues as before, with C2’s UTC (Universal Tuple Compiler).

The purpose of Clang/C2 for Windows is to improve cross-platform support, as much for Microsoft’s own projects as for third-party developers. Microsoft’s approach with applications like Office is to put as much non-visual code as possible into cross-platform C++ code.

The mobile version of Office is now available on Android, iOS and the Windows 10 Universal Windows Platform. Using Clang for the front-end on all three platforms removes the possibility of bugs or workarounds caused by differences in C1 and Clang.

Developers will also welcome Clang because of its better standards compliance compared with Visual C++, for C as well as C++. Microsoft Engineering Manager Steve Carroll (from the front-end team), who also spoke at CPPCon, explained that while Microsoft’s support of the C99 and C11 standards is already much improved, Clang/C2 will complete it.

Carroll added that Microsoft is not abandoning C1 but will continue to improve it.

There are Microsoft extensions and Windows-specific features in the Visual C++ compilers which means they will still be needed. In addition, performance tests generally show slightly better performance for C1/C2 versus Clang/C2.

Radigan said Clang will not be forked and that Microsoft is contributing code back to the community to improve Clang and LLVM on Windows. No code specific to C2 will be proposed for the open source tools.

The initial release of Clang/C2 will be a preview, followed by a further update planned for February 2016.

There is more than Clang/C2 on the way for Visual C++. Microsoft is changing its approach to updates, so that more feature changes will be fully supported during the lifetime of Visual Studio 2015, rather than remaining in preview until the next major version. Support for asynchronous programming using “await” will be updated to match Microsoft’s current standards proposal, among other new features.

The company is also set to release a “build only” edition of Visual C++, which will install the compiler and command-line build tools without the Visual Studio IDE. ®

Sign up to our NewsletterGet IT in your inbox daily

14 Comments

More from The Register

Shhh! Microsoft, Intel, Google and more sign up to the Confidential Computing Consortium

You can make your own joke about foxes and hen houses...

Facebook, Microsoft, Google among tender, caring tech giants on UK internet safety board

The kids are in good hands

Google takes a page from Microsoft of old and revives browser ballot on Android

There's no place like Chrome, but... here are the other guys

Devs invited to bake 'Run on Google Cloud' button into git repos... By Google, of course

An offer you can refuse?

Google rolls out Android Easter Egg for Europe – a Microsoft antitrust-style browser, search engine choice box

Now how about we forget these fines, eh, mes amies? Meine Freunde? Mis amigos?

Microsoft, you should look away now: Google's cloud second only to AWS in dev survey

Mountain View's white stuff used more than Azure among 7,000 code monkeys

Microsoft's Cortana booted off yet another service while Google and AWS get a bit catty over licensing shakeup

Roundup Also: Redmond buddies up with Reliance Jio Infocomm (no, not that Infocom)

Facebook, Google, Microsoft, Twitter make it easier to download your info and upload to, er, Facebook, Google, Microsoft, Twitter etc...

GDPR put a gun to their heads

Google becomes third major cloud vendor to tie the knot with VMware

More cloud polygamy for Dell EMC's Virtzilla

Prez Trump to host chinwag with Google, Microsoft, Oracle and Qualcomm – report

And Sundar Pichai heads to grilling on Chocolate Factory's data slurping