![]()
October 2000
Volume 18 Number 10OBJECTS AND COMPONENTS
An Improved Variant Type Based on Member Templates
Fernando Cacciola
C has generic pointers and varying length argument lists for flexibility. C++ has templates for even more flexibility, and better type safety in the bargain.Classes for Reading and Writing Parameter Blocks
Andrew Queisser
Fortran IV let you read and write variables by name since the 1960s. It still makes sense to do so in C++.FEATURES
Introduction to Function Try Blocks
Alan Nash
Exceptions can occur in the darndest places. Fortunately, try blocks can also be written in most of those places.Optimizing Substring Operations in String Classes
Todd Niec
If reference counting is good for operations on whole strings, it should be good for operations on substrings too.C/C++ CONTRIBUTING EDITORS
The New C: Introducing C99
Randy Meyers
C99 is much like C89, but with more of the same lots more of the same.The Journeyman's Shop: When Bad Things Happen to Good Numbers
Pete Becker
It takes a lot of preparation to write really robust floating-point code.STL & Generic Programming: The Template Compilation Model
Thomas Becker
Templates change the way compilers and linkers interact, often in ways that are hard to fathom.Uncaught Exceptions: Sunshine Superman
Bobby Schmidt
Bobby answers several questions from the fringes of valid C++.Post-Mortem Debunker: Angelology
Stan Kelly-Bootle
Stan muses on pinheads who get rich and heads of pins that are angel poor.DEPARTMENTS
Editor's Forum
New Products
We Have Mail
C++ EXPERTS FORUM WEB-EXCLUSIVE
In this new, web-only component of CUJ, we continue publication of the columns that were popular in the former C++ Report magazine. The following articles are featured on the CUJ website this month:
Are Set Iterators Mutable or Immutable?
Portability Issues in Using the Standard LibraryKlaus Kreft and Angelika Langer
The C++ Standard mandates that containers such as std::set provide both mutable and immutable iterators. Unfortunately, mutable iterators turn out to be dangerous when used with sets. If you use one to modify an element of a set, you risk corrupting the underlying data structure. Langer and Kreft explain why this is so, and they discuss some of the less-than-desirable solutions – including non-portable implementations of the standard library. The authors then propose a more sensible, and portable, solution using iterator adapters.Generic<Programming>: Mappings between Types and Values
Andrei Alexandrescu
In C++, you can do a lot more things at compile time than may be immediately obvious, including selecting the right algorithm based on an integer constant, and determining if one type supports conversion to another type. Andrei Alexandrescu shows us a handful of remarkably simple, reusable templates that make such compile-time magic possible.Engineering Notebook: Developing at a Sustainable Pace
Robert C. Martin
Death marches, 12-hour workdays, and crash development schedules produce something besides programmer burnout – buggy code that’s impossible to maintain. Robert Martin explains why so many projects fail, and lays out the path for a healthy approach to software development.