August 2014

Thoughts on C++14 -- Jens Weller

Jens Weller gives a nice perspective on the C++ landscape in 2014.

Thoughts on C++14

by Jens Weller

From the article:

Yesterday we could read on isocpp.org that C++14 has been approved and will now become a valid ISO Standard. Great news for everyone in the C++ land! ...

But there is something else that makes C++14 for me special...

CppCon Free Friday, Final Plenary Session -- Boris Kolpackov

CppCon is less than three weeks away! Announced today:

Free Friday, Final Plenary Session

by Boris Kolpackov 

From the announcement:

We previously announced that CppCon 2014 evening content (Mon-Thu 8:30pm onward) and early morning breakfast sessions (Tue-Fri 8:00-8:45) do not require registration. In addition, this year, we are making the whole of Friday free as well. If you’re in the Seattle area, you’ll want to swing by and enjoy the Friday end-note plenary session and the final panel with us. And the final plenary session will be:

Herb Sutter: "Back to the Basics! Essentials of Modern C++ Style"

This talk revisits basic questions, such as how to declare and initialize a variable, how to pass a value to a function, how to write a simple loop, and how to use smart pointers, in the light of experience with C++11 and the latest C++14 refinements. This involves examining auto, rvalue references, range-for loops, uniform initialization, lambda expressions, unique_ptr and shared_ptr, and more.

Using Varadic Templates for a Signals and Slots Implementation in C++ -- Paul Cook

Fresh on GameDev.net:

Using Varadic Templates for a Signals and Slots Implementation in C++

By Paul Cook

From the article:

Abstract

Connecting object instances to each other in a type-safe manner is a well-solved problem in C++ and many good implementations of signals and slots systems exist. However, prior to the new varadic templates introduced in C++0x, accomplishing this has traditionally been complex and required some awkward repetition of code and limitations.

Varadic templates allow for this system to be implemented in a far more elegant and concise manner and a signals/slots system is a good example of how the power of varadic templates can be used to simplify generic systems that were previously difficult to express. ...

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?