Multiple versions of the C++ programming language are in various stages of development, and tech companies such as Facebook and Microsoft are trying to keep up with feature support.
Facebook is focusing on augmenting the capabilities C++ 11, the C++ standard published back in 2011 that was superseded by C++ 14 last year. The company recently introduced Folly Futures, its C++ implementation allowing for asynchronous coding through Futures, a C++ object representing the result of an asynchronous computation. Futures, the post explained, allow Facebook to sort through the more efficient but more complicated asynchronous code, with features like chained callbacks, and sequential and parallel code composition.
(Related: Facebook spurns HTML5 for React)
Facebook also uses an executor interface to control C++ 11 callbacks, addressing the problem of losing track of errors or exceptional conditions.
“Programmers must exercise great (even superhuman) discipline to check for errors and take appropriate action, to say nothing of what happens when an unexpected exception is thrown,” wrote Facebook developer Hans Fugal in the blog post. “Futures address this problem by containing either a value or an exception, and exceptions behave like you would expect exceptions to when composing futures…”
Engineers are using C++ 11 Futures in different ways at Facebook-owned Instagram, leveraging them to create a “Suggested Users” recommendation service and a “Chaining” feature for generating recommended accounts to follow. As an Instagram Engineering blog post explained, the company’s engineers use Facebook’s Thrift threading model and non-blocking I/O to program and run more-efficient C++ 11 code.
Microsoft delves into C++ 14 and 17
While Facebook builds upon a past C++ standard with its own custom features, Microsoft is working to integrate features of the current standard C++ 14 and upcoming C++ 17 standard into Visual Studio 2015.
According to a Microsoft blog post, while the company supports the majority of C++ 11 core language and library features, it has also finished its standard library implementation of C++ 14, and is close to completing its C++ 17 implementation for inclusion in the RTM release of Visual Studio 2015.
Stephan T. Lavavej, a Microsoft senior software development engineer who maintains Visual Studio’s C++ Standard Library implementation, explained in a blog post why Microsoft has chosen to keep up with new C++ standards rather than settle on and develop custom features for a particular version.
“We’ve been focused on achieving Standard conformance, which is higher priority than implementing the various Technical Specifications that are being produced by the [C++] Committee,” he wrote. “We think [Technical Specifications] are important, but the Standard is even more important.”