May 2015

CppCon 2014 Microsoft w/ C++ to Deliver Office Across Different Platforms, Part II—Zaika Antoun

Have you registered for CppCon 2015 in September? Don’t delay – Early Bird registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2014 for you to enjoy. Here is today’s feature:

Microsoft w/ C++ to Deliver Office Across Different Platforms, Part II

by Zaika Antoun

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

What does it take to target multiple major mobile devices (as well as traditional environments) with portable, efficient, single-source code? This talk demonstrates architectures, techniques, and lessons learned rooted in actual experience with using C++ to deliver several major cross-platform projects across iOS, Android, Windows, and Mac: Microsoft Office (Word, Excel, PowerPoint, OneNote) and the SQL Server PowerBI. Each presents a different case study: For example, Office already used C++, whereas PowerBI was originally written in Silverlight and then rewritten in C++; Office is a set of user-facing apps, whereas PowerBI is a system component. Although some of these are demanding first-tier “Cadillac” applications, we expect this experience to be a model for the future as more and more apps fall into this category and use C++ to target many popular platforms from (mostly) a single source base. This talk will cover the following key topics and tradeoffs: Rich vs. reach, including access to latest OS features (e.g., iOS 8 additions) and hardware features (e.g., vector units, GPUs). Consistency of functionality. Client code vs. server/service web code. Sharing vs. quality, including dialing appropriately between more shared code and high quality code. Drawing the line between the bulk of C++ code and interfacing with non-C++ for UX and PALs (platform adaptation/abstraction layers) for target-specific user interface and system services. Architecting PALs, including why “mini-PALs” rather than an “über-PAL.” Forces “doing the right thing” and good architecture with composable components. How C++ enables things not feasible using other technologies. Velocity and enabling faster cross-platform development and deployment. Cost of maintenance, including time, size, and complexity (both breadth and depth). And, last but not least, developing in a single modern C++ source base built with different evolving C++ compilers, including VC++ and Clang/LLVM.

How to implement a stateful meta-container in C++ -- Filip Roséen

Implementing stateful meta contianer in C++ Using Modern C++.

How to implement a stateful meta-container in C++

by Filip Roséen

From the article:

This post has explained the technical aspects related to an implementation of a stateful meta-container, allowing a developer to more easily work with, and modify, a given set of entities during the phase of translation.

Together with the previous posts in this series, the formerly unstateful world of translation has gone into a stateful universe — allowing for some crazy, but conforming, implementations.

Quick Q: Why are override and final identifiers with special meaning instead of reserved keywords?

Quick A: To avoid breaking old code, thanks to context-sensitive keywords.

Recently on SO:

Why are override and final identifiers with special meaning instead of reserved keywords?

Both the override specifier and final specifier were added in C++11. They differ from other specifiers added to C++11 such as constexpr and decltype, in that they are not keywords and so are available for use as identifiers:

int main()
{
  int override = 0 ;    // Ok
  int final = 0 ;       // Ok
  //int constexpr = 0 ; // Error
}

They are referred to as identifiers with special meaning, which is covered in the draft C++11 standard section 2.11 [lex.name] (emphasis mine):

The identifiers in Table 3 have a special meaning when appearing in a certain context. When referred to in the grammar, these identifiers are used explicitly rather than using the identifier grammar production. any ambiguity as to whether a given identifier has a special meaning is resolved to interpret the token as a regular identifier.
and Table 3 -- Identifiers with special meaning lists both override and final.

Why did these two specifiers end up being identifiers with special meaning instead of keywords?

New C++ experimental feature: The tadpole operators--Raymond Chen

You should read about this amazing new feature:

New C++ experimental feature: The tadpole operators

by Raymond Chen

From the article:

How often have you had to write code like this:

x = (y + 1) % 10;
x = (y + 1) * (z - 1);
x = (wcslen(s) + 1) * sizeof(wchar_t);

Since the + and - operators have such low precedence, you end up having to parenthesize them a lot, which can lead to heavily nested code that is hard to read...

Once you have been thoroughly amazed, you should also read this article:

The tadpole operators explained

Cling Aims to Provide a High-performance C++ REPL--Sergio De Simone

Read about a REPL allowing to test things rapidly in C++:

Cling Aims to Provide a High-performance C++ REPL

by Sergio De Simone

From the article:

Cling is an interactive C++ interpreter that is built on top of LLVM and Clang and promises to provide a leap in productivity by going beyond the usual code-compile-run-debug C++ workflow...

Other useful materials:

CppCast Episode 13: Testdriven C++ using Catch with Phil Nash

Episode 13 of CppCast the only podcast by C++ developers for C++ developers. In this episode Rob and Jason are joined by Phil Nash to talk about C++ Unit Testing with Catch.

CppCast Episode 13: Testdriven C++ using Catch with Phil Nash

by Rob Irving and Jason Turner

About the interviewee:

Phil is a semi-independent software developer, coach and consultant - working in as diverse fields as finance, agile coaching and iOS development. A long time C++ developer he also has his feet in C#, F#, Objective-C and Swift - as well as dabbling in other languages. He is the author of several open source projects - most notably Catch: a C++-native test framework.

Boost Your Productivity with Modern C++ -- June 8-12 (German), June 22-26 (English)

gottschling-seminar.PNGEarly-bird registration ends on Friday:

Boost Your Productivity with Modern C++

Leipzig, Germany

June 8-12, 2015 (German)

June 22-26, 2015 (English)

From the announcement:

Do you develop your developers?

Only when the last programmer is gone to Silicon Valley, we will realize that the digital progress won’t wait for us.

Google, Facebook, Amazon are clear examples showing that the growth of the IT market is passing by Germany. Over here, the formation of IT experts is systematically neglected. The industry is held back by the shortage of skilled programmers. Though we cannot create new developers for you, we can lift YOUR developers to the next level.

Yet in times of Big Data and Industry 4.0 the popularity of C++ remains unaffected, especially for operating systems, compilers and embedded systems. The revolutionary improvements in C++11 and C++14 brought the language further into the center of attention. For C++17, we are expecting even more spectacular progress.

Our practical training is based on the exclusive material from our tutor’s yet unpublished book on this powerful language.

The training is not a dull walk through all features of C++ but an inspiration how they can be applied with maximal efficacy. The programming language offers a wide variety of possibilities to create your own abstractions -- up to building your own embedded domain-specific language. Thereby, C++ is the only programming language allowing for such powerful abstractions while gaining maximal performance. Good C++ programming decreases the risk of errors and increases the programs' robustness. In addition, your programs will be even clearer, easier, and more attractive to your co-workers -- thus, more readable and maintainable.

Interactive exercises with practical relevance combine theory with your everyday business. We offer an intensive training in small groups with up to 10 participants in German or English. It is designed for software developers who want to develop high quality programs characterized by intuitive interfaces and maximum performance. At the end of the training, a certificate for each participants will be issued.

Trainer: Dr. Peter Gottschling is the author of the Matrix Template Library 4, co-author of Boost Graph Library as well as various other libraries. He was Head of the German delegation to the ISO Committee for the standardization of C++ and is Vice Chairman of the DIN Committee for programming languages. He has taught C++ at the Technische Universität Dresden, Technische Universität Berlin and Indiana University. Today, he is the CEO of SimuNova while working on his book "Discovering Modern C++" that will be released later this year.

C++17 Fold Expressions--Baptiste Wicht

You should read that if you want to know more about this exciting future feature of C++:

C++17 Fold Expressions

by Baptiste Wicht

From the article:

C++11 introduced variadic template to the languages. This new feature allows to write template functions and classes taking an arbitrary number of template parameters. This a feature I really like and I already used it quite a lot in my different libraries. Here is a very simple example computing the sum of the parameters:

// Good with variadics
auto old_sum(){
    return 0;
}

template<typename T1, typename... T>
auto old_sum(T1 s, T... ts){
    return s + old_sum(ts...);;
} 

// Better with fold expressions
template<typename... T>
auto fold_sum_1(T... s){
    return (... + s);
}x

Mach7: Pattern Matching for C++

Here is a new library to perform pattern matching:

Mach7: Pattern Matching for C++

by Yuriy Solodkyy, Gabriel Dos Reis and Bjarne Stroustrup

From the article:

Pattern matching is an abstraction mechanism that can greatly simplify source code. Commonly, pattern matching is built into a language to provide better syntax, faster code, correctness guarantees and improved diagnostics. Mach7 is a library solution to pattern matching in C++ that maintains many of these features. All the patterns in Mach7 are user-definable, can be stored in variables, passed among functions, and allow the use of open class hierarchies...

Example:

// Fibonacci numbers
int fib(int n)
{
    var<int> m;

    Match(n)
    {
      Case(1)     return 1;
      Case(2)     return 1;
      Case(2*m)   return sqr(fib(m+1)) - sqr(fib(m-1));
      Case(2*m+1) return sqr(fib(m+1)) + sqr(fib(m));
    }
    EndMatch
}

CppCon 2014 Microsoft w/ C++ to Deliver Office Across Different Platforms, Part I--Zaika Antoun

While we wait for CppCon 2015 in September, we’re featuring videos of some of the 100+ talks from CppCon 2014. Here is today’s feature:

Microsoft w/ C++ to Deliver Office Across Different Platforms, Part I

by Zaika Antoun

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

What does it take to target multiple major mobile devices (as well as traditional environments) with portable, efficient, single-source code? This talk demonstrates architectures, techniques, and lessons learned rooted in actual experience with using C++ to deliver several major cross-platform projects across iOS, Android, Windows, and Mac: Microsoft Office (Word, Excel, PowerPoint, OneNote) and the SQL Server PowerBI. Each presents a different case study: For example, Office already used C++, whereas PowerBI was originally written in Silverlight and then rewritten in C++; Office is a set of user-facing apps, whereas PowerBI is a system component. Although some of these are demanding first-tier “Cadillac” applications, we expect this experience to be a model for the future as more and more apps fall into this category and use C++ to target many popular platforms from (mostly) a single source base. This talk will cover the following key topics and tradeoffs: Rich vs. reach, including access to latest OS features (e.g., iOS 8 additions) and hardware features (e.g., vector units, GPUs). Consistency of functionality. Client code vs. server/service web code. Sharing vs. quality, including dialing appropriately between more shared code and high quality code. Drawing the line between the bulk of C++ code and interfacing with non-C++ for UX and PALs (platform adaptation/abstraction layers) for target-specific user interface and system services. Architecting PALs, including why “mini-PALs” rather than an “über-PAL.” Forces “doing the right thing” and good architecture with composable components. How C++ enables things not feasible using other technologies. Velocity and enabling faster cross-platform development and deployment. Cost of maintenance, including time, size, and complexity (both breadth and depth). And, last but not least, developing in a single modern C++ source base built with different evolving C++ compilers, including VC++ and Clang/LLVM.