We have C++14!

C++14 is done!

Following the Issaquah meeting in February, we launched the Draft International Standard (DIS) ballot for the next C++ standard. That ballot closed on Friday.

Today, we received the notification that the ballot was unanimously successful, and therefore we can proceed to publication. We will perform some final editorial tweaks, on the order of fixing a few spelling typos and accidentally dropped words, and then transmit the document to ISO for publication this year as the brand new International Standard ISO/IEC 14882:2014(E) Programming Language C++, a.k.a. C++14.

C++ creator Bjarne Stroustrup writes: "C++14 was delivered on schedule and implementations are already shipping by major suppliers. This is exceptional! It is a boon to people wanting to use C++ as a modern language."

Thanks very much to our tireless C++14 project editor Stefanus DuToit and his helpers, and to all the members of the C++ standards committee, for bringing in this work on time and at high quality with a record low number of issues and corrections in the CD and DIS ballots!

Not only is this the fastest turnaround for a new standard in the history of C++, but as Bjarne noted this is historic in another way: There are already multiple substantially or entirely conforming implementations (modulo bugs) of C++14 available already today or in the near future -- at the same time C++14 is published. That has never happened before for a C++ (or I believe C) standard. For C++98, the delta between publishing the standard and the first fully conforming implementation being available was about 5 years. For C++11, it was two years. For C++14, the two have merged and we have achieved "time on target."

Thanks again, everyone. This was a team effort.

C++11/14 Idioms I Use Every Day -- Paul Cechner

Start your Monday the right way by sending this to three of your friends who are new to (modern) C++:

C++11/14 Idioms I Use Every Day

by Paul Cechner

From the article:

Most attention on the new C++ has focused on the changes that provide functionality and performance that was previously not possible, both library enhancements (chrono, regex, smart pointers, and stuff to help with lambdas for example) and core language enhancements (perfect forwarding, variadic templates, the new memory model and threading capabilities, initialiser lists and the like). This functionality will impact us all in helping to write more correct code and efficient libraries, but often will only be relevant in certain parts of our code.

But the first thing that struck me when I started using C++11 was the smaller features that I could take advantage of every time I put my fingers to the keyboard. These are the things that make code more concise and simple and allow me to present my intentions more clearly. ...

Stroustrup: Why the 35-year-old C++ still dominates 'real' dev -- Paul Krill, Infoworld

infoworld.PNGToday in Infoworld:

Stroustrup: Why the 35-year-old C++ still dominates 'real' dev

C++ inventor details the language's latest changes and assesses the strengths and weaknesses of its competitors

by Paul Krill, Infoworld

From the interview:

Bjarne Stroustrup designed the C++ language in 1979, and the general-purpose language for systems programming has become a mainstay for developers everywhere, despite competition from Java, JavaScript, Python, Go, and Apple's newly unveiled Swift.

Now a technologist at Morgan Stanley and a professor at both Columbia University and Texas A&M University, Stroustrup spoke with InfoWorld Editor at Large Paul Krill about C++'s role today and about other happenings in software development, including Google's Go and Apple's Swift languages. ...

N4131: Another response to N4074; explicit should never be implicit -- Filip Roséen

A new WG21 paper is available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4131

Date: 2014-08-89

Another response to N4074; explicit should never be implicit

by Filip Roséen

Excerpt:

This paper will try to prove why the proposed change of ISO C++ in N4074 shouldn't be allowed using several methods, among them are:

  • Discussions of the, sometimes hidden, implications of such change, and:
  • Arguments regarding how such initialization will differ from the current praxis of C++, and:
  • Proof of Concepts that directly shows why such proposal is not sane.

Bjarne Stroustrup AMA -- Slashdot

The live interview takes place next week. The question submission thread is open now:

Interviews: Ask Bjarne Stroustrup About Programming and C++

In addition to being the creator of C++, Bjarne Stroustrup is a Managing Director in the technology division of Morgan Stanley, a Visiting Professor in Computer Science at Columbia University, and a Distinguished Research Professor in Computer Science at Texas A&M University. Bjarne has written a number of books and was elected a member of the National Academy of Engineering. He will be doing a live Google + Q & A within the C++ community on August 20th, 2014 at 12:30pm EST, but has agreed to answer your questions first. As usual, ask as many as you'd like, but please, one per post.

Quick Q: Does make_shared avoid an extra allocation for the reference counts? -- StackOverflow

A: Yes, make_shared is your friend!

Recently on SO:

What happens when using make_shared

I'm interested if these two lines of code are the same:

shared_ptr<int> sp(new int(1)); // double allocation?
shared_ptr<int> sp(make_shared<int>(1)); // just one allocation?

If this is true could someone please explain why is it only one allocation in the second line?

CppCon 2014 Volunteers Wanted -- by Boris Kolpackov

Especially if you're local to the Seattle area, this is a great way for students and others to be part of CppCon.

CppCon 2014 Volunteers Wanted

by Boris Kolpackov

Of course if you're a student you also have the option of the discounted Student registrations that let you attend the whole thing without the distraction of occasionally holding up signs and untangling A/V cords -- some Student registrations are still available. But there's also fun in being part of running things.

From the announcement:

If you would like to attend CppCon 2014, see great C++ content, and meet our speakers and attendees, but a week’s registration doesn’t fit your time or money budget, consider volunteering.

We are looking for volunteers to help run the conference. We need people to help assemble registration packets and badges, register attendees, assist speakers with Audio/Video, and in general be on hand to make things run smoothly. In exchange, we’ll see to it that you’ll spend at least half of your time in sessions. It would be great if you could join us for the whole week, but if you can only make it for one or two days, we can work with that. This is a particularly great opportunity for local students with an interest in C++. If you are interested or would like more information, please email volunteers@cppcon.org.

CppCon Program Highlights, 12 of N: Advanced Meta Techniques

The CppCon 2014 conference program has been posted for the upcoming September conference. We've received requests that the program continue to be posted in "bite-sized" posts, a few sessions at a time, to make the 100+ sessions easier to absorb, so here is another set of talks. This series of posts will conclude once the entire conference program has been posted in this way.

 

No C++ conference would be complete without coverage of advanced techniques that enable high performance, expressive power, or both at the same time. Here is a selection of some of the advanced topics that will be presented this year at CppCon.

In this post:

  • Practical Functional Programming in C++
  • Practical Type Erasure
  • Pragmatic Type Erasure: Solving Classic OOP Problems with an Elegant Design Pattern
  • Polymorphism with Unions
  • Modern Template Metaprogramming: A Compendium

 

Practical Functional Programming in C++

To the untrained eye, pure functional programming may appear to be out of place in our traditionally imperative C++ world. However, the functional paradigm has become increasing prominent in production C++ codes, especially when implementing asynchronous execution.

This talk is intended as a primer for attendees who are either unfamiliar with functional programming or have doubts its practical uses in modern C++. The following topics will be covered:

* Functions as First-Class Entities (function objects, lambdas, Callable, std::function) * Higher Orders (, composition/bind) * Functions with Clear Inputs/Outputs (pure functions - side effect free) * Monads and Parallelism (future/promise, async)

Examples from different sectors of industry/academia will be presented throughout.

No prior functional programming knowledge will be needed. While this talk will cover some theory, coverage of non-C++ programming languages will be minimal. The focus of this talk will be the application of theories from FP to C++, not FP itself.

Speaker: Bryce Adelstein-Lelbach. Bryce Adelstein-Lelbach is a researcher at the Center of Computation and Technology (CCT) at Louisiana State University. He works on the HPX runtime system and his research interests include parallel and distributed programming frameworks for scientific applications. He has been working on HPX for over a year now.

 

Practical Type Erasure

Type erasure looks like a neat concept, but what are its real life uses? This talk will briefly show the inner workings of type erasure, and demonstrate a real working implementation of a configuration system from public domain production code. Uses and pitfalls of type erasure will also be covered.

Speaker: Cheinan Marks, Spiral Genetics. As an engineer with a chemical engineering background, Cheinan is interested in practical code and wants to take the latest advances both in science and programming and use them in real life working code along with applying engineering principles to software development. Cheinan is a senior developer at Spiral Genetics, Inc. in Seattle.

 

Pragmatic Type Erasure: Solving Classic OOP Problems with an Elegant Design Pattern

There are numerous, serious OOP design problems that we have all encountered in production code. These include, among others: - object lifetime/ownership - how to make classes from different class hierarchies conform to a common interface - writing classes that can present multiple interfaces - separating interface and implementation - how to write virtual functions so that subclasses override them properly - the virtual inheritance "diamond of death"

Proper use of type erasure can mitigate, or outright eliminate, these and other problems, without sacrificing performance.

This talk will cover the OOP design problems above and more, and will cover hand-rolled and library-based type erasure approaches that solve those problems. Performance metrics will be provided for the different approaches, and source code will be available after the talk.

Speaker: Zach Laine, Senior Programmer, Intific. Zach Laine has been using C++ in industry for 11 years, focusing on data visualization, numeric computing, games, generic programming, and good library design. He finds the process of writing bio blurbs to be a little uncomfortable.

 

Polymorphism with Unions

Using tagged unions to create families of polymorphic types that are more flexible and more easily maintained than those formed with inheritance alone. We demonstrate the design pattern and implementation techniques of sum types with examples from a compiler development project. We also examine the technique's impact on project management and engineering and on algorithm design, including the role of type switches, value type semantics, and multiple dispatch polymorphism.

Speaker: Jason Lucas, Architect, Orly Atomics. Jason Lucas is an alum of the Microsoft Visual C++ team and has been writing extensively in C++ since the early 90s. He is the architect for Orly, an open source, large-scale, distributed, transactional, and consistent graph database (all in C++) which also includes a compiler for distributed programs.

 

Modern Template Metaprogramming: A Compendium

Template metaprogramming has become an important part of a C++ programmer's toolkit. This talk will demonstrate state-of-the-art metaprogramming techniques, applying each to obtain representative implementations of selected standard library facilities. Along the way, we will look at void_t, a recently-proposed, extremely simple new candidate whose use has been described by one expert as "highly advanced (and elegant), and surprising even to experienced template metaprogrammers."

Speaker: Walter E. Brown . With broad experience in industry, academia, consulting, and research, Dr. Walter E. Brown has been a C++ programmer for over thirty years, joining the C++ standards effort in 2000. Among numerous other contributions, he is responsible for introducing such now-standard C++ library features as cbegin/cend and common_type as well as headers and , and has significantly impacted such core language features as alias templates, contextual conversions, and variable templates. He conceived and served as project editor for the International Standard on Special Mathematical Functions in C++. When not playing with his grandchildren, Dr. Brown is an Emeritus participant in the C++ standards process, with several more core and library proposals under consideration. He was recently appointed an associate project editor for the C++ standard itself.

CppCon 2014 Call for Lightning Talks -- Boris Kolpackov

cppcon-025.PNGMuch of the CppCon content is outside session hours, including lightning talks. Details announced today on cppcon.org:

CppCon 2014 Call for Lightning Talks

by Boris Kolpackov

From the announcement:

On Tuesday, the evening program will include Lightning Talks -- 4 talks of 15 minutes and 4 talks of 5 minutes. Expect fast paced fun with talks that are funny or intriguing from speakers at all experience levels.

If you’ve never seen a lighting talk before, check out this example (it’s just 4 and a half minutes long and funnier if you know Ruby or JavaScript) or search you tube for “lightning talk” to see a variety of examples. They cover a single topic and they start with the good stuff and make a point. Anyone can do one, but be sure to practice because 5 minutes goes by incredibly fast and 15 minutes isn’t much easier. If there’s one technique you wish everyone knew, one little known fact that should be well known, one tool that makes your life easier every day, or a collection of little things that you can fit into 5 or 15 minutes, you can propose a lighting talk, and you should.

We’ll be selecting the 8 sessions on Monday, Day 1 of the conference, from submissions we receive before and during the conference. Just email open-content@cppcon.org and tell us what you want to talk about, what length you need and a little bit about yourself. Even if you don’t plan to submit, plan to attend, it’s sure to be fun!