C++ 11 Style

Duration: 1 hour 25 mins 21 secs
Share this media item:
Embed this media item:


About this item
Description: This presentation reflects Bjarne Stroustrup's thoughts on what “Modern C++” should mean in the 2010s: a language for programming based on light-weight abstraction with a direct and efficient mapping to hardware, suitable for infrastructure code
 
Created: 2012-02-16 16:17
Collection: Annual Wheeler lectures
Publisher: University of Cambridge
Copyright: Bjarne Stroustrup
Language: eng (English)
Keywords: C++; Style; Programming; Computer Science;
 
Abstract: We know how to write bad code: Litter our programs with casts, macros, pointers, naked new and deletes, and complicated control structures. Alternatively (or in addition), obscure every design decision in a mess of deeply nested abstractions using the latest object-oriented programming and generic programming tricks. For good measure, complicate our algorithms with interesting special cases. Such code is incomprehensible, unmaintainable, usually inefficient, and not uncommon.

But how do we write good code? What principles, techniques, and idioms can we exploit to make it easier to produce quality code? I will make an argument for type-rich interfaces, compact data structures, integrated resource management and error handling, and highly-structured algorithmic code. I will illustrate my ideas and motivate my guidelines with a few idiomatic code examples.

I will use C++11 freely. Examples include auto, general constant expressions, uniform initialization, type aliases, type safe threading, and user-defined literals.

C++ features are only just starting to appear in production compilers, so some of my suggestions have the nature of conjecture. However, developing a “modern style” is essential if we don’t want to maintain newly-written 1970s and 1980s style code in 2020.

This presentation reflects my thoughts on what “Modern C++” should mean in the 2010s: a language for programming based on light-weight abstraction with a direct and efficient mapping to hardware, suitable for infrastructure code.

Bjarne Stroustrup is the designer and original implementer of C++
Available Formats
Format Quality Bitrate Size
MPEG-4 Video 480x360    1.84 Mbits/sec 1.15 GB View Download
iPod Video 480x360    505.38 kbits/sec 315.99 MB View Download
MP3 44100 Hz 125.01 kbits/sec 77.96 MB Listen Download
Auto * (Allows browser to choose a format it supports)