Interview: Bjarne Stroustrup Discusses C++ -- William Wong

William Wong recently interviewed Bjarne Stroustrup for Electronic Design.

Interview: Bjarne Stroustrup Discusses C++

by William Wong

Much of the content will be familiar to those who've seen or read other recent interviews, but it's a nice concise summary of the essence of C++ including examples in code. If someone you know wonders why C++ was created, or what is the essence of its purpose as a language, or how modern C++ code looks and feels, this article is a good place to send them.

Why does std::condition_variable take a std::unique_lock instead of a std::mutex? -- StackOverflow

Recently on StackOverflow, someone asked: What's the job of std::unique_lock when used with std::condition_variable::wait()?

A more detailed answer is available in this earlier question, including why taking a unique_lock makes the C++ version superior to some other libraries' designs:

C++11: Why does std::condition_variable use std::unique_lock?

I am a bit confused about the role of std::unique_lock when working with std::condition_variable. As far as I understood the documentation, std::unique_lock is basically a bloated lock guard, with the possibility to swap the state between two locks.

I've so far used pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) for this purpose (I guess that's what the STL uses on posix). It takes a mutex, not a lock.

What's the difference here? Is the fact that std::condition_variable deals with std::unique_lock an optimization? If so, how exactly is it faster?

 

Trip report: Fall ISO C++ meeting -- Michael Wong

Michael Wong, head of Canadian delegation, has posted Part 1 of his report on the September ISO C++ meeting held in Chicago.

The View from the C++ Standard meeting September 2013 Part 1

by Michael Wong

From the article:

At this meeting, the most important thing was to address as many of the National Body (NB) Comments from the draft C++14 CD possible. This will enable us to be in good shape for the release of C++14 in 2014. Please look at my blog series to get an idea of the major content. However, this meeting did have some interesting minor changes which modified that content. This is fairly normal to decouple features which is still controversial. The biggest change is the moving of VLA (or what we called Array of Runtime Bound) and dynarray into a library array TS, and the adoption of the single quote as a digit separator for C++14.

This week in C++: EDG 4.8 and Visual C++ 2013

The past week saw new releases of two major C++ implementations, with a focus on standards conformance improvements.

Edison Design Group (EDG) shipped version 4.8 of their C++ compiler front-end. This is the first EDG C++ release to achieve full C++11 language conformance. It adds support for C++11 inheriting constructors, user-defined literals, thread_local variables, alignment support (alignof and alignas), and complete decltype support.

Note: You can't buy a complete compiler from EDG, but EDG's front-end is a key part of several major commercial compilers and tools. With the availability of 4.8, this means that EDG-based products such as Intel's ICC compiler could achieve full language conformance when they can integrate the EDG 4.8 front-end in a future release.

Microsoft shipped Visual C++ 2013, a major update to VC++ 2012 with additional C++ conformance features. Since last year's release, VC++ 2013 adds the following ISO C++ features: explicit conversion operators, raw string literals, function template default arguments, delegating constructors, { } uniform initialization syntax and initializer_lists, variadic templates, non-static data member initializers, =default, =delete, and using aliases. This release also include some small post-C++11 features that were approved earlier this year for inclusion in the draft of the upcoming C++14 standard, including make_unique, nonmember cbegin/cend, the improved <functional> operator functors such as greater<>, and the new transformation trait type aliases such as remove_reference_t.

At the GoingNative conference in September, Microsoft also announced that before the end of the year it expects to release a follow-on "alpha" or preview compiler containining initial implementations of additional C++11 language features, likely including 'some or all of' the following: implicit move function generation, & and && qualifiers on member functions, __func__, extended sizeof, thread-safe initialization of function local static variables, unconditional noexcept, constexpr on functions other than constructors, and possibly inheriting constructors. The CTP is also expected to include support for several new draft-standard C++14 language features, including auto function return type deduction, decltype(auto), and possibly the much-anticipated C++14 marquee feature generic lambdas. It will likely also include an initial implementation of the await concurrency language feature that is being proposed for possible inclusion in a future standard.

N3824: make_array -- Zhihao Yuan

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

Date: 2013-10-22

make_array

by Zhihao Yuan

Excerpt:

We have make_tuple, make_pair, but not make_array, while std::array creation can also benefit from this “semiofficial” tuple-like interface to deduce both element type and array bound.

CGAL 4.3 Released, Computational Geometry Algorithms Library

cgal_front_page_2013.pngThe CGAL Open Source Project is pleased to announce the release 4.3 of CGAL, the Computational Geometry Algorithms Library.

Besides fixes to existing packages, the following has changed since CGAL 4.2:

  • The CGAL Manual generated with Doxygen

    The documentation of CGAL is now generated with Doxygen: http://doc.cgal.org/4.3

    The conversion to Doxygen from our home-made tools was not completely smooth. Please report any documentation bug you may discover to our Inria Forge bug tracker.

  • 2D Periodic Triangulations (new package)

    This package allows to build and handle triangulations of point sets in the two dimensional flat torus. Triangulations are built incrementally and can be modified by insertion or removal of vertices. They offer point location facilities. The package provides Delaunay triangulations and offers nearest neighbor queries and primitives to build the dual Voronoi diagrams.

See http://www.cgal.org/releases.html for a complete list of changes.

The CGAL project is a collaborative effort to develop a robust, easy-to-use, and efficient C++ software library of geometric data structures and algorithms, such as:

  • triangulations (2D constrained triangulations, Delaunay triangulations and periodic triangulations in 2D and 3D),
  • Voronoi diagrams (for 2D and 3D points, 2D additively weighted Voronoi diagrams, and segment Voronoi diagrams),
  • Boolean operations on polygons and polyhedra,
  • regularized Boolean operations on polygons with curved arcs
  • arrangements of curves,
  • mesh generation (2D, 3D and surface mesh generation, surface mesh subdivision and parametrization),
  • alpha shapes (in 2D and 3D),
  • convex hull algorithms (in 2D, 3D and dD),
  • operations on polygons (straight skeleton and offset polygon),
  • search structures (kd trees for nearest neighbor search, and range and segment trees),
  • interpolation (natural neighbor interpolation and placement of streamlines),
  • optimization algorithms (smallest enclosing sphere of points or spheres, smallest enclosing ellipsoid of points, principal component analysis),
  • kinetic data structures.

Some modules are distributed under the terms of the LGPL Open Source license (GNU Lesser General Public License v3 or later versions). Most modules are distributed under the terms of the GPL Open Source license (GNU General Public License v3 or later versions). If your intended usage does not meet the criteria of the aforementioned licenses, a commercial license can be purchased from GeometryFactory.

For further information and for downloading the library and its documentation, please visit the CGAL web site.

Post-Chicago standards papers mailing available

The official post-meeting standards papers mailing is now available. It includes meeting minutes, the winter meeting agenda, updated issues lists, and a number of new papers including some that came through the public std-proposals forum. (Update: Please also direct discussion about these papers to that forum.)

Note: All of these papers have also been posted already to this site’s Standardization RSS feed. Subscribe to that feed to see the papers as they appear.

 

N3767 Teleconference Minutes (September 2013) Kyle Kloepper 2013-09-13 2013-10      
N3768 Minutes (September 2013) Kyle Kloepper 2013-10-16 2013-10      
N3769 Minutes: PL22.16 Meeting No. 60, 15-20 April 2013 - Bristol, UK Kyle Kloepper          
N3770 C++ CD Comment Status, Rev. 1 William M. Miller 2013-10-14 2013-10      
N3771 Canadian C++14 Comments H. Tong, M. Wong 2013-09-22 2013-10      
N3772 Changing the type of address-of-member expression David Rodríguez Ibeas 2013-09-05 2013-10   Evolution  
N3773 async and ~future (Revision 4) Herb Sutter 2013-09-12 2013-10 N3637 Concurrency Revised N3776, N3777
N3774 C++ Needs Language Support For Vectorization A. Naumann, S. Wenzel 2013-09-19 2013-10   Concurrency  
N3775 Deprecating rand() and Friends Walter E. Brown 2013-09-25 2013-10   Library  
N3776 Wording for ~future Herb Sutter 2013-09-23 2013-10 N3773 Concurrency  
N3777 Wording for deprecating async Herb Sutter 2013-09-23 2013-10 N3773 Concurrency  
N3778 C++ Sized Deallocation Lawrence Crowl 2013-09-27 2013-10 N3663 Core/ Library  
N3779 User-defined Literals for std::complex Peter Sommerlad 2013-09-24 2013-10   Library  
N3780 Why Deprecating async() is the Worst of all Options Nico Josuttis 2013-09-26 2013-10   Concurrency  
N3781 Single-Quotation-Mark as a Digit Separator L. Crowl, R. Smith, J. Snyder, D. Vandevoorde 2013-09-25 2013-10 N3448 Evolution  
N3782 Index Based Ranges (Rev. 1) A. Shödl, F. Fracassi 2013-09-24 2013-10 N3752 Ranges  
N3783 Network Byte Order Conversion Robert Pratte 2013-09-27 2013-10 N3646 Networking  
N3784 Improvements to std::future<T> and Related APIs N. Gustafsson, A. Laksberg, H. Sutter, S. Mithani 2013-09-27 2013-10 N3721 Concurrency  
N3785 Executors and schedulers, revision 3 C. Mysen, N. Gustafsson, M. Austern, J. Yasskin 2013-10-8 2013-10 N3731 Concurrency  
N3786 Prohibiting "out of thin air" results in C++14 Hans-J. Boehm 2013-9-24 2013-10   Concurrency  
N3787 What can signal handlers do? (CWG 1441) Hans Boehm 2013-10-14 2013-10 N3633 Concurrency  
N3788 Immediate issues Alisdair Meredith 2013-09-27 2013-10 N3754 Library  
N3789 Constexpr Library Additions: functional Marshall Clow 2013-09-27 2013-10 N3749 Library  
N3790 Working Draft, Technical Specification -- File System Beman Dawes 2013-09-27 2013-10 N3693 Filesystem  
N3791 Lightweight Drawing Library - Objectives, Requirements, Strategies Beman Dawes 2013-10-11 2013-10   Graphics  
N3792 Working Draft Technical Specification - URI G. Matthews, D. Berris 2013-10-11 2013-10 N3720 Networking  
N3793 A proposal to add a utility class to represent optional objects (Revision 5) F. Cacciola, A. Krzemieński 2013-10-03 2013-10 N3672 Library Evolution  
N3794 Proposal to Add Multi-Dimensional Support to std::array Daryle Walker 2013-10-10 2013-10   Library Evolution  
N3795 A more common version of algorithm std::partition_copy Vladimir Grigoriev 2013-09-16 2013-10   Library Evolution  
N3796 std::rand replacement Zhihao Yuan 2013-10-02 2013-10   Library Evolution  
N3797 Working Draft, Standard for Programming Language C++ Stefanus Du Toit 2013-10-13 2013-10 N3691    
N3798 C++ Editor's Report, October 2013 Stefanus Du Toit 2013-10-13 2013-10      
N3799 AGENDA: PL22.16 Meeting No. 62, WG21 Meeting No. 57, February 10-15, 2014 - Issaquah, WA, USA Stephen D. Clamage 2013-10-07 2013-10      
N3800 A proposal to add a generalized callable negator (Revision 1) Tomasz Kamiński 2013-09-16 2013-10 N3699 Library  
N3801 Removing Undefined Behavior from the Preprocessor Gabriel Dos Reis 2013-10-14 2013-10   Undefined behavior, Core  
N3802 apply() call a function with arguments from a tuple Peter Sommerlad 2013-10-08 2013-10   Library Evolution  
N3803 Programming Languages -- C++ Standard Library -- File System Technical Specification Beman Dawes 2013-10-05 2013-10 N3790 Filesystem  
N3804 Any Library Proposal (Revision 3) B. Dawes, K. Henney, D. Krügler 2013-10-09 2013-10 N3508 Library  
N3805 SPRING 2014 JTC1/SC22/WG21 C++ STANDARDS COMMITTEE MEETING: Preliminary Information Peter Sommerlad     N3569    
N3806 C++ Standard Core Language Active Issues, Revision 86 William M. Miller 2013-10-14 2013-10 N3713 Core  
N3807 C++ Standard Core Language Defect Reports and Accepted Issues, Revision 86 William M. Miller 2013-10-14 2013-10 N3714 Core  
N3808 C++ Standard Core Language Closed Issues, Revision 86 William M. Miller 2013-10-14 2013-10 N3715 Core  
N3809 Proposal for Unbounded-Precision Integer Types Pete Becker     N3542 Numerics  
N3810 Alternatives for Array Extensions Bjarne Stroustrup 2013-10-13 2013-10   Evolution  
N3811 C++ Standard Evolution Active Issues List (Revision R04) Ville Voutilainen 2013-10-12 2013-10 N3736 Evolution  
N3812 C++ Standard Evolution Completed Issues List (Revision R04) Ville Voutilainen 2013-10-12 2013-10 N3737 Evolution  
N3813 C++ Standard Evolution Closed Issues List (Revision R04) Ville Voutilainen 2013-10-12 2013-10 N3738 Evolution  
N3814 Call for Compile-Time Reflection Proposals J. Snyder, C. Carruth 2013-10-06 2013-10   Reflection  
N3815 Enumerator List Property Queries A. Tomazos, C. Käser 2013-10-03 2013-10   Library Evolution  
N3816 Polymorphic Memory Resources - r1 Pablo Halpern 2013-10-13 2013-10 N3726 Library Evolution  
N3817 C++ Latches and Barriers Alasdair Mackintosh 2013-10-11 2013-10 N3666 Concurrency  
N3818 Centralized Defensive-Programming Support for Narrow Contracts (Revision 2) J. Lakos, A. Zakharov 2013-10-11 2013-10 N3753 Library  
N3819 Concepts Lite Specification A. Sutton, B. Stroustrup, G. Dos Reis 2013-10-11 2013-10   Concepts  
N3820 Working Draft, Technical Specification -- Array Extensions Lawrence Crowl 2013-10-10 2013-10   Evolution  
N3821 C++ Standard Library Active Issues List (Revision R85) Alisdair Meredith 2013-10-14 2013-10 N3754 Library  
N3822 C++ Standard Library Defect Report List (Revision R85) Alisdair Meredith 2013-10-14 2013-10 N3755 Library  
N3823 C++ Standard Library Closed Issues List (Revision R85) Alisdair Meredith 2013-10-14 2013-10 N3756 Library  

N3821-23: C++ Standard Library Issues List (Revision R85) -- Alisdair Meredith

New WG21 papers are available. Copies are 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: N3821-23

Date: 2013-10-14

C++ Standard Library Active Issues List (Revision R85)

C++ Standard Library Defect Report List (Revision R85)

C++ Standard Library Closed Issues List (Revision R85)

by Alisdair Meredith

Excerpt:

The purpose of this document is to record the status of issues which have come before the Library Working Group (LWG) of the INCITS PL22.16 and ISO WG21 C++ Standards Committee.

N3819: Concepts Lite Speciļ¬cation -- Andrew Sutton

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

Date: 2013-10-11

Concepts Lite Specification

by Andrew Sutton

Excerpt:

C++ has long provided language support for generic programming in the form of templates. However, these templates are unconstrained, allowing any type or value to be substituted for a template argument, often resulting in compiler errors. What is lacking is a specification of an interface for a template, separate from its implementation, so that a use of a template can be selected among alternative templates and checked in isolation.