Wednesday Afternoon, Half Day
C++ Idioms
Convention Ctr — Room 13
Jan Christiaan van Winkel, AT Computing

This tutorial will address non trivial C++ programming constructs that experienced programmers use frequently. These constructs are too small to be called patterns, but they are part of the language skills of the proficient C++ programmer. Therefore we call them idioms. Several idioms will be discussed, such as:

Traits. Traits classes are used frequently in the C++ standard. Some libraries are built around traits classes, for example the Boost library (www.boost.org). Using traits, it is possible to get hold of information about a type at compile-time, that will then influence behavior at runtime.

Intermediate objects. These are often used as proxy objects to write something in C++ that the syntax disallows, such as a[1][2] where a is of class type. They exist only in the expression in which they are used.

Resource management through the “Resource Acquirement is Initialization” idiom. Not only allocated memory has to be returned. If a function needs to change a formatting flag in an ostream, that change has to be undone when the function ends.

After the tutorial the attendee will recognize several idioms, and know when to use them. As with any language, knowing idioms will improve your fluency.

Attendee Background: The attendees are expected to know C++.

Presenter: JC van Winkel has a B.S. and an M.S. in computer science (the M.S. from the Vrije Universiteit Amsterdam). He works at AT Computing, a small courseware and consulting firm in Nijmegen, the Netherlands. There he teaches UNIX and UNIX-related subjects, including C and C++. Except for 1995, J.C. van Winkel has presented tutorials at all OOPSLAs since 1993. He is the Dutch representative in the ISO C++ standardization committee SC22/WG21.

Tutorials
at a Glance
Tutorials by Track
Full Description
of all Tutorials
Final Program