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.