Stroustrup's "Software Development for Infrastructure" paper selected by CR Best of 2012

From the TAMU CS blog:bs-sdfi.PNG

Stroustrup paper selected by Computing Reviews Best of 2012

"Software Development for Infrastructure" by Dr. Bjarne Stroustrup was selected as a notable paper in computing in 2012 by ACM's Computing Reviews Best of 2012. The Best of 2012 list consists of book and article nominations from CR's reviewers and category editors, the editors in chief of journals covered by CR, and others in the computing community. The paper was a cover feature article published in the IEEE Computer Society's January 2012 issue.

The basic premise of the paper is that "Infrastructure software needs more stringent correctness, reliability, efficiency, and maintainability requirements than non-essential applications. This implies greater emphasis on up-front design, static structure enforced by a type system, compact data structures, simplified code structure, and improved tool support. Education for infrastructure and application developers should differ to reflect that emphasis."

Dr. Stroustrup concludes that "In research, we need a greater appreciation of incremental (engineering) improvements with a relevance to real-world systems. 'That's just engineering, and we're computer scientists' is an attitude we can't afford. I suspect the era of transformative breakthroughs is over. We need to achieve a factor-of-two-or-three improvement in several areas, rather than trying to solve our problems with a single elusive two-orders-of-magnitude improvement from a silver bullet."

GotW #6a Solution: Const-Correctness, Part 1 -- Herb Sutter

The solution to GotW #6a is now available:

GotW #6a Solution: Const-Correctness, Part 1 (updated for C ++11/14)

by Herb Sutter

From the article:

Starting with C++11, const on a variable that is possibly shared means read-only, safe to read concurrently without external synchronization.

If you perform any operation on a const shared variable x, or call a const member function on x, you can assume that operation does not change the observable value of x -- or even modify the bits of x in an observable way even in the presence of concurrency. ...

Guideline: Remember the “M&M rule”: For a member variable, mutable and mutex (or atomic) go together. ...

Quick Q: Why pass by value then move? -- StackOverflow

Quick A: Because it's a new C++11 parameter passing pattern, also recently mentioned as part of GotW #4.

Why do we copy then move?

I saw code somewhere in which someone decided to copy an object and subsequently move it to a data member of a class. This left me in confusion in that I thought the whole point of moving was to avoid copying. Here is the example:

 

struct S
{
    S(std::string str) : data(std::move(str))
    {}
};

Here are my questions:

  • Why aren't we taking an rvalue-reference to str?
  • Won't a copy be expensive, especially given something like std::string?
  • What would be the reason for the author to decide to make a copy then a move?
  • When should I do this myself?

Lambdas vs. Closures -- Scott Meyers

This bears repeating:

Lambdas vs. Closures

by Scott Meyers

From the article:

In recent days, I've twice found myself explaining the difference between lambdas and closures in C++11, so I figured it was time to write it up. ...

GotW #5 Solution: Overriding Virtual Functions -- Herb Sutter

The solution to GotW #5 is now available:

GotW #5 Solution: Overriding Virtual Functions (updated for C ++11/14)

by Herb Sutter

From the article:

Exactly one of the following can be true for a polymorphic type:

  • Either destruction via a pointer to base is allowed, in which case the function has to be public and had better be virtual;
  • or else it isn’t, in which case the function has to be protected (private is not allowed because the derived destructor must be able to invoke the base destructor) and would naturally also be nonvirtual (when the derived destructor invokes the base destructor, it does so nonvirtually whether declared virtual or not).

C++Now 2013 Trip Report -- Jens Weller

Reporting from the just-concluded C++Now 2013 event:

C++ Now 2013 -- Trip Report

by Jens Weller

From the article:

This years sessions focused a lot on threading, which brought great talks about atomics, transactional memory or C++11 threading to the conference. I have to admit, that threading is not my main interest in C++, so not all of those talks were meant for me. But having three tracks always gives you a great choice. And also gave me the confidence that the decision to go for 3 tracks at this years Meeting C++ conference was right.

GotW #4 Solution: Class Mechanics -- Herb Sutter

The solution to GotW #4 is now available:

GotW #4 Solution: Class Mechanics (updated for C++11/14)

by Herb Sutter

From the article:

... To see why, consider the following canonical forms for how operator+= and operator+ should normally be implemented for some type T.
T& T::operator+=( const T& other ) {
    //...
    return *this;
}

 

T operator+( T a, const T& b ) {
    a += b;
    return a;
}

Did you notice that one parameter is passed by value, and one by reference? That’s because if you’re going to copy from a parameter anyway, it’s often better to pass it by value, which will naturally enable a move operation if the caller passes a temporary object such as in expressions like (val1 * val2) + val3. We’ll see more on parameter passing in a future GotW. ...

.

New paper: N3692, C++ Editor's Report, May 2013 -- Stefanus Du Toit

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3692

Date: 2013-05-16

C++ Editor's Report, May 2013

by Stefanus Du Toit

This is the editor's report on applying the changes approved at Bristol to produce the updated working draft and Committee Draft that was posted here yesterday.

Excerpt:

Statistics: The latest draft adds wording from 64 CWG issues, 11 CWG papers, 36 LWG issues, 14 LWG papers, 5 SG1 issues, and 1 SG1 paper.

... For a full list of editorial changes, please see the C++ draft repository on GitHub.

GotW #3 Solution: Using the Standard Library (or, Temporaries Revisited) -- Herb Sutter

The solution to GotW #3 is now available:

GotW #3 Solution: Using the Standard Library (or, Temporaries Revisited) (updated for C++11/14)

by Herb Sutter

From the article:

With no other changes, simply using the standard find algorithm could do everything the range-based for loop did to avoid needless temporaries (and questions about them) [...] and it further increases our level of abstraction.

C++14 Committee Draft (CD) Published at isocpp.org -- Michael Wong

[Ed.: Thanks to Michael Wong for sharing his commentary and perspective on the C++14 CD while on the scene at the C++Now conference. Posted at the IBM C/C++ Cafe blog.]

C++14 Committee Draft (CD) published at isocpp.org

C++14 Committee Draft is here and can be accessed at isocpp.org. This is in keeping with the practice of greater transparency ... [and] was also announced to the C++NOW crowd by Jens Weller at the Community evening session last night.