October 2013

No Runtime Overhead -- Bulldozer00

sharedunique.pngA little nugget about the free-as-in-no-overhead-ness of unique_ptr and std::move:

No Runtime Overhead

by Bulldozer00

From the article:

Unless I really need shared ownership of a dynamically allocated object, which I haven’t so far, I stick to the slimmer and more performant std::unique_ptr. ...

Out Parameters, Move Semantics, and Stateful Algorithms -- Eric Niebler

In this article, Eric Niebler discusses an issue of API design regarding the age-old question of out parameters versus return-by-value, this time in light of move semantics. He uses std::getline as his example.

Out Parameters, Move Semantics, and Stateful Algorithms

by Eric Niebler

From the article:

I think getline is a curious example because what looks at first blush like a pure out parameter is, in fact, an in/out parameter; on the way in, getline uses the passed-in buffer’s capacity to make it more efficient. This puts getline into a large class of algorithms that work better when they have a chance to cache or precompute something.

 

N3798: C++ Editor's Report, October 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: N3798

Date: 2013-10-13

C++ Editor's Report, October 2013

by Stefanus Du Toit

Excerpt:

N3797 is the latest C++ Working Draft. It contains the changes to the C++14 CD as directed by the committee at the Chicago 2013 meeting. Details of the changes are listed below.

N3811-13, Evolution Issues Lists—Ville Voutilainen

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 numbers: N3811-13

Date: 2013-10-12

C++ Standard Evolution Active Issues List (Revision R04)

C++ Standard Evolution Completed Issues List (Revision R04)

C++ Standard Evolution Closed Issues List (Revision R04)

by Ville Voutilainen

Excerpt:

The purpose of this document is to record the status of issues which have come before the Evolution Working Group (EWG) of the INCITS PL22.16 and ISO WG21 C++ Standards Committee. Issues represent potential defects in the ISO/IEC IS 14882:2003(E) document, and proposed extensions to it.

N3791: Lightweight Drawing Library -- Objectives, Requirements, Strategies -- Beman Dawes

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: N3791

Date: 2013-10-11

Lightweight Drawing Library -- Objectives, Requirements, Strategies

by Beman Dawes

Excerpt:

This paper suggests objectives, requirements, and strategies for SG13, the C++ committee's graphics study group. These ideas were presented to SG13 at their organizational meeting in Chicago on September 28th. They are my personal views and do not necessarily represent the views of other SG13 members. The general ideas presented here were developed over a number years watching endless discussions on the Boost developers list that never reached consensus, let alone produce a tangible library proposal.

Objective: Success

This paper isn't about the technical aspects of a library technical specification (TS) for a lightweight drawing library -- rather it presents an approach to creating such a TS in a way that maximizes the chance of success. ...

Double-Checked Locking Is Fixed in C++11 -- Jeff Preshing

preshing.PNGJeff Preshing gives a nice overview of the on-again/off-again/on-again status of a common approach to lazy initialization.

[Ed: Note that DCLP is not just for thread-safe singletons, that's just a handy example. It's for lazy initialization in general.]

Double-Checked Locking Is Fixed in C++11

by Jeff Preshing

From the article:

The double-checked locking pattern (DCLP) is a bit of a notorious case study in lock-free programming. Up until 2004, there was no safe way to implement it in Java. Before C++11, there was no safe way to implement it in portable C++.

As the pattern gained attention for the shortcomings it exposed in those languages, people began to write about it. In 2000, a group of high-profile Java developers got together and signed a declaration entitled “Double-Checked Locking Is Broken”. In 2004, Scott Meyers and Andrei Alexandrescu published an article entitled “C++ and the Perils of Double-Checked Locking”. Both papers are great primers on what DCLP is, and why, at the time, those languages were inadequate for implementing it.

All of that’s in the past. Java now has a revised memory model, with new semantics for the volatile keyword, which makes it possible to implement DCLP safely. Likewise, C++11 has a shiny new memory model and atomic library which enable a wide variety of portable DCLP implementations. C++11, in turn, inspired Mintomic, a small library I released earlier this year which makes it possible to implement DCLP on some older C/C++ compilers as well.

In this post, I’ll focus on the C++ implementations of DCLP...

N3804: Any Library Proposal (Revision 3) -- Beman Dawes, Kevlin Henney, Daniel Krügler

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: N3804

Date: 2013-10-09

Any Library Proposal (Revision 3)

by Beman Dawes, Kevlin Henney, Daniel Krügler

Excerpt:

This paper proposes a type-safe container for single values of value types. The C++ standards committee is planning to include the proposal in a library Technical Specification (TS).

The proposal is based on the Boost Any Library (see www.boost.org/libs/any). The Boost version of library has been in wide use for over a decade, and the library has been implemented at least twice in addition to the Boost implementation. The proposal is a pure addition to the standard library, requires no modifications to any C++14 standard library components, requires no compiler support, and will have no effect on existing namespace-disciplined code.

N3803: File System Technical Specification (PDTS) -- Beman Dawes

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: N3803

Date: 2013-10-05

File System Technical Specification (PDTS)

by Beman Dawes

Excerpt:

This Technical Specification specifies requirements for implementations of an interface that computer programs written in the C++ programming language may use to perform operations on file systems and their components, such as paths, regular files, and directories. This Technical Specification is applicable to information technology systems that can access hierarchical file systems, such as those with operating systems that conform to the POSIX ([fs.norm.ref]) interface. This Technical Specification is applicable only to vendors who wish to provide the interface it describes.