Thursday, December 26, 2002

Public Talks in 2003

I just updated my Seminars page (http://www.aristeia.com/seminars.html) to
reflect the talks I've agreed to give at conferences in the first half of
2003. Briefly, I'll be in Santa Clara, CA, for Software Development in
March; in New Orleans, LA, for VS.NET Connections in May; and in Orlando,
FL, to give a keynote at STAREast, also in May.

Some of the conference sites don't have talk descriptions up yet, so not
all of my talk titles are currently linked to an abstract. I'll take care
of the links when I can, but as a mailing list exclusive, below I've listed
the talk descriptions I submitted to the various conferences. Please bear
in mind that what they print is not always what I sent them, sigh. All the
listed talks are for approximately 60-90 minutes except for "Effective STL
Programming," which is an abbreviated version of my standard seminar
described at http://www.aristeia.com/estl/index_frames.html; the conference
version will be only half the usual length (the usual length is two days),
so I'm going to have to chop a bunch of stuff out.

It's not official yet, but there's a very good chance I'll be back in
Germany (probably in Berlin and elsewhere) the second half of September.
I'll keep you posted on that and anything else that develops.

I hope to see you sometime, somewhere in 2003!

Scott


Library Design and the C++ Standard Library

One of the goals of the standard library is to demonstrate good library
design. Scott's been studying and critiquing class and library designs
for many years, and in this talk, he turns his attention to the standard
library. After promulgating several principles of good design, he looks
at the standard library to see how it measures up. The goal of this talk
is to learn some things about library design in general as well as the
standard library in particular. This talk focuses on the STL parts of
the library.


Better Software -- No Matter What

Traditional development methodologies preach one way to produce quality
software; agile methodologies preach something quite different. XP
advises developers to implement things as simply as possible, but it also
discourages sacrificing quality. Web site designers have to worry about
supporting multiple browsers and about minimizing round-trips to the
server, but native application developers worry more about runtime
performance. This talk argues that there are software development
practices that improve softare quality, regardless of the domain of the
application, the platform on which it runs, or the users it is intended
to serve. It further argues that there are minimal quality standards
that virtually all software should adhere to, regardless of its purpose.
In short, the talk is about improving software quality, no matter what
the software does, how it does it, or whom it does it for.


False Friends in C++

When learning a foreign language, it's common to encounter "false
friends:" constructs that look like things in your native language, but
that have different meanings. C++ developers moving from C to ARM C++ to
Template C++ to STL C++ to Exception-Safe C++ also encounter false
friends: new C++ constructs that look like old ones, but that behave
differently.

In this talk, Scott identifies a number of important false friends in
C++, explaining the differences between the pairs, why the differences
exist, and how to know which of the false friends should be used
when. Specific topics include declaring symmetric binary operators for
class templates, the interaction of implicit template instantiation and
implicit generation of special member functions, rules for overloading
resolution versus those for template parameter type deduction, passing
parameters to STL-compatible templates, testing for assignment to self in
exception-safe code, using swap on strings, and more.


Approaches to the Static Intialization Problem

Nonlocal static objects defined in different C++ translation units may be
initialized in any order. This becomes problematic when one such object
is dependent on another, i.e., when the order of initialization is
important. This talk recaps the static initialization problem and
describes the advantages and disadvantages of the three most common ways
of addressing it: the "nifty counter" trick, the GOF Singleton, and the
Meyers Singleton. The talk ends with a description of the Alexandrescu
Singleton, a new approach based on template metaprogramming.

This talk offers a nice mix of practical, down-to-earth information as
well as a glimpse into how work on template metaprogramming is beginning
to lead to workable approaches to real problems. It also offers a chance
to see how template templates can be used. You read that right: template
templates :-)


Rvalues in C++

In C, rvalues act much like const objects, and this is true for the C
subset of C++, too. Move beyond C, however, and the rules change. Rvalues
no longer arise in all the expected places, and even when they do, they
don't always act like their C-subset counterparts.

This talk starts with an overview of rvalues and lvalues in C, then shows
how the concepts apply in C++ and why what you know from C is unlikely to
help you much in C++. Scott then explores the relationships among
rvalues, const, assignment, member functions, references, and temporary
objects, focusing on how the interactions among these things affect C++
program behavior. As long as he's in the neighborhood, he also looks at
the related STL notions of iterators vs. const_iterators, constant
vs. mutable iterators, and, of course, the meaning of non-const constant
iterators.


Testing and Implicit Requirements: Expanding the Unwritten Spec

Some software requirements are so obvious, we don't even bother to write
them down. Words should be spelled correctly. Button labels should fit
within the boundaries of their buttons. The system should not freeze,
crash, or burst into flames. Such requirements are implicit, but they're
important. Though we rarely create test cases for them, we routinely
note when they are violated.

Both internal and external software quality would improve if the software
community would agree on additional implicit requirements, requirements
that grow out of a small number of fundamental quality principles. This
talk will introduce a few such principles and will examine the implicit
requirements they lead to.

Attendees of this talk will walk away with:

- An understanding of the importance of implicit requirements in software
testing.

- An awareness of software quality principles that give rise to implicit
requirements.

- Specific examples of things to test for (or at least to note during
testing) that will help enforce the new implicit requirements.


Effective STL Programming
(One Day Tutorial)

C++'s Standard Template Library is revolutionary, but learning to use it
well can be a significant challenge. This seminar, based on Scott's
latest book, Effective STL, reveals the critical rules of thumb employed
by the experts -- the things they almost always do or almost always avoid
doing -- to get the most out of the library. The seminar is divided into
the following modules:

Containers

The many technical issues that determine which container is best for the
job; the folly of trying to write container-independent code; why range
member functions are preferable to their single-element counterparts;
avoiding resource leaks when storing pointers; why containers should
never hold auto_ptrs; choosing the correct eraseing option.

vector and string

Why vector and string are preferable to dynamically allocated arrays;
using reserve to avoid unnecessary reallocations; using vector and string
with legacy APIs.

Associative Containers

The importance of equivalence, and how it differs from equality; why
comparison functions should always return false for equal values; issues
involved in in-place modification of set and multiset elements.

Algorithms

Choosing among sort, stable_sort, partition, stable_partition, and
nth_element; the true behavior of remove and remove-like algorithms and
how this interacts with containers of pointers.

Functors, Functor Classes, Functions, etc.

Why functor classes should be designed for pass-by-value; why predicates
should be pure.

Programming with the STL

Why algorithm calls are usually preferable to hand-written loops;
choosing among count, find, binary_search, lower_bound, upper_bound, and
equal_range; why function objects are more efficient than functions.

Recommended Reading

Useful books, articles, magazines, web sites, and newsgroups.

Audience

Systems designers, programmers, and technical managers involved in the
design, implementation, and maintenance of production libraries and
applications using the STL. Participants should already know the basic
features of the STL (e.g., containers, iterators, algorithms, and
function objects), but expertise is not expected. People who have learned
the STL recently, as well as people who have been programming with it for
some time, will come away from this intensive seminar with useful,
practical, proven information.

Difficulty Level

Primarily intermediate, with some more elementary and some more advanced
material.

Format

Lecture and question/answer. There is no hands-on programming.

Length

One full day.

Sunday, December 15, 2002

Interview with me available at artima.com

In August, I was interviewed by Bill Venners. Bill's a Java guy, but he's
a *nice* Java guy :-) He's decided to post the interview in six weekly
installments, starting today. You can find the first installment at
http://www.artima.com/intv/abcs.html. The primary topic is multiple
inheritance.

Enjoy,

Scott

Monday, December 9, 2002

Benefit Talk near Portland, OR, December 17

On Tuesday, December 17, I'll be joining two other noted consultants in the
Portland area, Karl Wiegers and Rebecca Wirfs-Brock, in a software
engineering benefit for Norm Kerth. You can read all about the event at
http://cpd.ogi.edu/class.asp?n=03-CPD-1217

The cause is a very good one, and the talks promise to be top-notch, so I
hope you'll attend. Here's a description of the topic I'll be addressing:

NOTHING WORKS AND NOBODY CARES

Every industry falls short of the mark from time to time, but in the PC
industry, horrific customer experiences are endemic. At least that's been
Scott's experience. Marketing materials are misleading, documentation
lies, products don't work, and customer support is variously incompetent,
condescending, surly, or nonexistent. In other words, nothing works and
nobody cares.

In this talk, Scott summarizes some of his experiences with products from
several major hardware and/or software vendors, demonstrating how each
often conveys a message to prospective and current customers that
satisfaction, far from being a goal, isn't even on the radar screen. He
also offers practical suggestions for improving the situation, starting
with a radical idea: when a customer complains that your product fails to
live up to his or her expectations, (1) say you're sorry and (2) mean it.

Ambitious attendees may wish to perform a simple experiment before the
talk: choose two or three products you use regularly, then, using the
product documentation, determine how users are supposed to report bugs.

Scott

Thursday, October 10, 2002

New CUJ Article; TCS3; gcc 3.2 for Windows

Three things:
- New CUJ article by me.
- Status Report on THE C++ Seminar later this month.
- EZ gcc 3.2 for Windows (thanks to Leor Zolman).

NEW CUJ ARTICLE
---------------
The current CUJ (November 2002) has an article by me on how combining class
templates, member functions templates, and total specialization of a class
template can lead to STL-compatible function objects that are a lot easier
to use than the ones in the STL. Unless you saw me present this material
at THE C++ Seminar in March or at Software Development in April, this will
probably be new to you. Personally, I think it's kind of neat. For the
time being, the article will be available only in the print magazine, but I
expect to make an electronic copy available sometime in December.

I don't know why, but I can't help but point out that with this
publication, I have published new material every year since 1989. That's
nothing compared to many columnists, some of whom have produced new
material every week or month for decades, but I've done the columnist
thing, and there's a qualitative difference between writing to meet a
deadline (as columnists must do) and writing only when you think you have
something interesting to say. If you'd like to see a summary of when I've
thought that, mosey on over to http://www.aristeia.com/publications.html.

THE C++ SEMINAR (TCS3)
----------------------
Andrei, Herb, Steve, Dan, and I are putting the finishing touches on THE
C++ Seminar, to be held at the end of this month in Vancouver, Washington
(near Portland, Oregon). More than one speaker took advantage of the
opportunity to change talk topics until literally the day we had to commit
the notes to CD, so I encourage you to check out the as-final-as-it-gets
schedule at http://www.thecppseminar.com/03/index.htm.

Regarding TCS3, I'm going to tell you two things I probably shouldn't.
First, I can't resist quoting a message -- without permission -- I recently
got from Andrei about work he's been doing and which he plans to present:

Scott, I have dynamite new material. Blood will shed on the streets!
Heads will roll!

Coding standards will change forever. Here's an example: I have strong
proof that the following classic implementations:

X& X::operator=(const X& rhs)
{
X copy(rhs);
copy.swap(*this);
return *this;
}

and

const X operator+(const X& lhs, const X& rhs)
{
return X(lhs) += rhs;
}

are about the WORST and UNRECOMMENDED signatures and implementations.

I now have a set of COMPLETELY NEW RULES on how to implement such
functions. The reward? ZERO UNNECESSARY TEMPORARY OBJECTS CREATED.

I don't know about you, but I want to be there when the blood starts
flowing, the heads start rolling, and the coding standards start changing.

The other thing I probably shouldn't tell you is that as things stand now,
we probably won't sell out. (Attendance is limited to 95.) From a
business point of view, that's bad news for us, but if you're an attendee,
it's great news. It means less contention if you want to sit and talk with
each of us, ask us questions, bounce design ideas off us, etc. I can't
make any guarantees, because we might end up selling out after all, but
currently it looks like TCS3 will honestly be the best opportunity there
has ever been to spend relatively uncrowded time with the five of us to
talk serious C++.

The TCS Home Page is at http://www.thecppseminar.com/index.htm.

GCC 3.2 FOR WINDOWS WITHOUT TEARS
---------------------------------
Speaking of quoting mail without permission, just today I got mail from
Leor Zolman describing how to get gcc 3.2 running under Windows without
Cygwin. This is important, because the current Mingw32 distribution
includes only gcc 2.95, yet gcc 3.2 has significant additional
capabilities. Until Leor figured out how to do it, getting gcc 3 installed
on non Cygwin Windows machine was a black art. But Leor wrote me:

I've updated my cheat sheet with the 3.2 information:

http://www.bdsoft.com/dist/MinGW-gcc3-install.txt

It also talks about how to code for multi-platform extended container
support with the right conditional compilation symbols.

HUGE DISCLAIMER: I haven't tested Leor's information myself, primarily
because I'm staring down the barrel of a bevy of very unforgiving
deadlines right now. But if the past is any indication, if you do what
Leor says, things will go swimmingly for you. If they don't, please TELL
LEOR, not me!

Scott
--------------------------------------
All new! THE C++ Seminar: Oct. 28-30 in Vancouver, WA.
http://www.thecppseminar.com/

Tuesday, September 10, 2002

TCS3 Reminder; New Talk Topic; Oct-Nov Talks Schedule

This issue's news:
- TCS3 early-bird registration deadline is this Sunday!
- New talk on C++ and Embedded Systems.
- Talks in England and Ireland in October.
- Talks in Germany in November.
- Talks in Boston in November.

TCS3 UPDATE
-------------------------------------
This October's "THE C++ Seminar" is filling up nicely, and I wanted to
remind you that the early bird registration deadline for this event is
Sunday. Unless you'll be attending as part of a group of four or more from
one company, you'll save $455 if you register by Sunday. (The official
rule is that you have to *pay* by Sunday, but the registrar is a friend of
mine, so I think I can get him to bend that rule by a few days as long as
you are registered by Sunday.) You can register at
http://www.thecppseminar.com/03/registration.htm.

BTW, I recently got inspired, so I changed my talk agenda a bit. You'll
find details on all the talks at the TCS3 page with the prospective
schedule (http://www.thecppseminar.com/03/index.htm), but here are the
topics I plan to address:
- False friends in C++
- Rvalues in C++
- Approximating Named Parameters in C++
Andrei seems to think that the false friends talk is a good one :-)


NEW TALK ON C++ IN EMBEDDED SYSTEMS
-----------------------------------
Software developers for embedded systems are increasingly interested in
using C++, so I'm putting together a new talk on making effective use of
C++ in embedded systems. This talk isn't listed at my web site yet,
because it's still in beta, but I'll be giving it in England, Ireland, and
Germany this autumn (see below). You can get an overview of the talk's
contents at http://www.programmingresearch.com/pressroom/scottmeyers.htm.
If you're involved in embedded development and think you might like to have
me come present the talk at your company, let me know.


TALKS IN ENGLAND AND IRELAND IN OCTOBER
---------------------------------------
In conjunction with Programming Research (http://www.programmingresearch.com/),
I'll be giving my new talk on C++ in embedded systems (see above) in
London, Manchester, Edinburgh, and Dublin on October 14-17, respectively.
You'll find links to each talk at my seminars page,
http://www.aristeia.com/seminars.html.


TALKS IN ULM (GERMANY) IN NOVEMBER
----------------------------------
I'll be working with QA Systems (http://www.qa-systems.com/) again this
year for a full week of talks (November 4-8 in Ulm): two days on class
design and efficiency, one day on C++ in embedded systems (see above), and
two days on effective STL programming. You'll find links to the details
for all these talks at my seminars page,
http://www.aristeia.com/seminars.html. Ich hoffe, Sie in Ulm zu sehen!


TALKS IN BOSTON IN NOVEMBER
---------------------------
I'll be speaking at the Software Development conference in Boston on
November 20-22. Two of the talks will be on C++, one on library design,
one on static initialization and policy based design. The other two talks
are on language-independent issues I consider important to all software
developers. One is on my current focus of research (and probably the topic
of my next book), "The Keyhole Problem." The other is on general
approaches to improving software quality. You'll find details by following
the links to these talks at my seminars page,
http://www.aristeia.com/seminars.html.


Between London, Manchester, Edinburgh, Dublin, Portland, Ulm, and Boston, I
hope to see you *somewhere* in October or November to discuss embedded
systems programming, false friends, rvalues, approximations to named
parameters, class design, efficiency, use of the STL, policy-based design,
general approaches to usability and other aspects of software quality, or
anything else that strikes your fancy :-)

Scott
--------------------------------------
All new! THE C++ Seminar: Oct. 28-30 in Vancouver, WA.
http://www.thecppseminar.com/

Tuesday, August 13, 2002

List policy change; TCS3 Schedule; Sep. 9 Talk in Bellevue, WA

Here's the docket:
- Modification to mailing list content policy
- TCS3 schedule now available
- Talk September 9 at WSA Developer SIG


Modification of Content Policy for this Mailing List
----------------------------------------------------
I'm fortunate that a lot of very smart people are on this mailing list.
Unsurprisingly, you know things that I don't know. As my professional
interests broaden beyond pure C++ programming, I increasingly find myself
with questions I can't answer and that my traditional contacts can't
answer, either. In many cases, I suspect that people on this mailing list
can answer them with ease. As a result, I've added the following paragraph
to the Contents and Policies section of the page that describes this
mailing list (http://www.aristeia.com/MailingList/index_frames.html):

Scott issues Requests for Assistance (RFAs) when he is looking for
specialized technical information and believes that one or more members
of the mailing list are likely to be able to help him find it. RFAs are
never mixed with announcements, and the subject of such messages always
begins with "RFA". Subscribers who wish to see announcements only should
configure their mail client(s) to filter out RFAs.

For example, as part of the research for my recent work on "Keyholes" (see
below), I'll need to get some practical information about how certain
changes in schema field types affect the size and performance of commercial
database systems, especially systems used by web servers. I expect a
question on that topic to be my first RFA. If you're a database person, I
hope you'll be willing to help me out.


TCS3 Schedule Now Available
---------------------------
Herb, Andrei, Dan, Steve, and I have put together a draft schedule of what
we expect to talk about at the October THE C++ Seminar. Everything is
brand spanking new, meaning we're all presenting material that we've never
published or presented publicly before. In addition, we've tinkered with
the seminar format a bit to allow more talks covering more topics, so this
TCS will likely cover more aspects of C++ than either of its predecessors.
Interestingly, I'm giving four talks this time instead of my customary two,
so this will be an especially good chance to, well, to see me drone on
twice as often as usual.

Descriptions of all the TCS3 talks and panels are available at
http://www.thecppseminar.com/03/index.htm#schedule, but here are my talk
topics. (They don't all match the official talk titles, because we often
try to choose cute titles, sometimes at the expense of clarity. The
following topic listing is designed to be clear, not cute.)
- Rvalues in C++
- Conveniently displaying the contents of STL containers
- False Friends in C++
- Using Smart Pointers with Incomplete Types
I don't mean to brag, but I think the rvalue talk will be really good. In
my experience, the differences between rvalues in C++ and their
counterparts in C lead to lots of confusion, and I'm hoping that this talk
will be able to clear things up.

BTW, please remember that the TCS3 deadline for early bird discounted
registration is September 15.


Talk September 9 for WSA Developer SIG in Bellevue, Washington
--------------------------------------------------------------
My most recent work has not been in C++. Instead, it's been on trying to
identify general "things" that lead to poor software quality. I'm
currently focusing on what I call the Keyhole Problem, and this talk
explains what that is, why it's important to everybody who does software
development, and practical approaches to solving it. Here's the talk
description I submitted to WSA:

THE KEYHOLE PROBLEM

Using a computer is an experience fraught with frustration and irritation,
and there's no good reason for it. Many of the most annoying aspects of
modern software systems stem from a single underlying problem: it's a big,
wide, wonderful world out there, but your computer refuses to let you see
more than a tiny bit at a time. It's like trying to see a room through a
keyhole, hence Meyers' name for the problem: The Keyhole Problem.

Keyholes are everywhere. A fixed-size window is a keyhole. A web input
form accepting a limited amount of text is a keyhole. A restriction on the
characters that can be used in a password is a keyhole. Using a signed
integer for a value that can never be negative is a keyhole. Most software
systems contains dozens of keyholes. All keyholes are harmful. Most are
easy to eliminate.

In this talk, Meyers describes the keyhole problem, shows dozens of
manifestations you encounter (and impose on the people who use your
software) every day, divides keyholes into several categories, and
explains how you can improve your software by eliminating keyholes
*without doing a lot of extra work*.

If you are involved in software development in any way, you need to know
about keyholes. They affect user interfaces, web site design, database
schemas, even the choice of variable types in programs. They are
relevant to software written in every language, running on every
platform, targeted at every domain, and employed by every type of user.
Come to this talk to see software systems through new eyes, eyes that
reveal not only how awful things are, but just how easy it would be to
make them a whole lot better.

The WSA Developers SIG web site is
http://www.wsa.org/events/sig/detail.asp?sigID=28, and I assume that
they'll post details on the when/where of the talk in the next few days.
If you'll be in the Bellevue area, I hope to see you at the talk. I expect
to cause a fair amount of controversy.

BTW, this talk is essentally the same as my keynote address at Software
Development in San Jose in April, so if you saw that talk, you won't see
too much in this one that's new. There is a new keyhole type I'll be
introducing, however...

Scott
--------------------------------------
All new! THE C++ Seminar: Oct. 28-30 in Vancouver, WA.
http://www.thecppseminar.com/

Thursday, July 25, 2002

TCS3 Registration is Now Open!

Andrei Alexandrescu, Herb Sutter, Steve Dewhurst, Dan Saks, and I will be
hosting an all-new incarnation of THE C++ Seminar (TCS) on October 28-30 in
Vancouver, Washington (just across the river from Portland, Oregon). If
you're not familiar with "THE C++ Seminar", you can read about the idea
behind it at http://groups.yahoo.com/group/scott_meyers/message/17 and can
get detailed information about it at http://www.thecppseminar.com/.

Our first TCS sold out at about 85 people, so for TCS2, we reserved more
space and accepted a lot more people. Afterwards, we decided that one of
the things we liked best about TCS1 was the intimate feeling and the chance
to spend time chatting with attendees, so for TCS3, we're limiting
enrollment to 95. More than ever, we encourage attendees to track us down
at TCS and talk/argue/brainstorm with us about interesting problems. We
wouldn't be doing this if we didn't thrive on that kind of thing!

Technically, my claim above of "all-new" is not quite true, because
although Andrei, Herb, Steve, and Dan have all promised to present material
they've never published or publicly spoken about, I'm being a deadbeat and
playing my cards a bit closer to the chest. One of my talks will
definitely be new, however, and I even know what it will be about:

Faux Amis in C++

English speakers learning French quickly encounter faux amis: French
words that look like English words, but that have different
meanings. Developers who progress from C to object-oriented C++ to
templates to the STL and then to generic programming also encounter faux
amis: new constructs that look like old ones, but that behave
differently. In this talk, Scott identifies a number of important faux
amis in C++, explaining the differences between the pairs, why the
differences exist, and how to know which of the false friends should be
used when.

I'm still mulling over the topic of my second talk. There is some chance
that it will include some material I'll be debuting in the UK earlier in
October (I'll post about that in a few days), and that's why I can't
guarantee that what I present at TCS3 will be ALL new. I can guarantee
that it will be mostly new, and I can also guarantee that it will cover
material I've never published. Unless you attend one of my UK talks this
October, my TCS3 talks will definitely cover material you have never seen
me cover before. (If there's a topic you'd like to see me address, send me
mail and let me know about it. I'm very supceptible to the powers of
suggestion.)

To learn more about TCS3, visit http://www.thecppseminar.com/03/. Be sure
to check out the link to the hotel (The Heathman Lodge), which is one of
the nicest places in the Portland metropolitan area. I should know: I
scouted out dozens of venues before choosing The Heathman. You can
register for TCS3 at http://www.thecppseminar.com/03/registration.htm.
Earlier is better than later, not only because we have an early bird rate
that expires on September 15, but also because of the enrollment limit of
95.

I hope to see you in Vancouver at the end of October.

Scott

Sunday, June 30, 2002

July Seminar Updates

Two quick notes about upcoming seminars with or by me:
- My workshop with Bruce Eckel has been cancelled.
- An excellent opportunity to take my Intro. STL course.


Workshops on Policy-Based Design
--------------------------------
The workshop on Policy-Based Design (PBD) and Patterns that Bruce Eckel and
I had planned to lead on July 18-19 in Crested Butte, Colorado, has been
cancelled. The people who signed up for it were as excited about it as we
were, but we ultimately decided that there just weren't enough of them to
make the event viable. That's too bad, because I think it would have been
both useful and fun. However, if you're a C++ Head (highly likely, if
you're on this list), there's still the one-day workshop on PBD that Andrei
Alexandrescu and I will be leading on October 31. Registration for that
should open around the middle of July. When it does, I'll let you know via
this mailing list.

An Effective Introduction to the STL
------------------------------------
July 22-25, Leor Zolman will be teaching my introductory hands-on STL
seminar at the SPC in Vancouver, CA. You can read about the seminar and
how I hand-chose Leor to teach it at
http://www.spc.ca/training/public/stlintro.htm, but here I want to focus on
two other things. The first is the cost. Assuming you are paying in
American dollars, the full four-day seminar costs only about $1300. This
is a great deal. The second is the need to register as soon as possible,
ideally this week, because enrollment is limited. (That's to make sure
that Leor has enough time to give everybody who attends the personalized
attention they deserve.) Regardless of the OS or C++ compiler you use, if
you've been thinking you'd like to learn about or better understand the
STL, this seminar is the way to go.

Scott

Thursday, May 2, 2002

Interactive Design Workshops in July and October

I have two unique workshops to announce:
- "Policy-Based Design and Patterns" with Bruce Eckel, July 18-19.
- "Policy-Based Design" with Andrei Alexandrescu, October 31.
Both are immersive, hands-on, and of limited enrollment. Details follow.

"Policy-based design" (PBD) is the term Andrei Alexandrescu uses to
describe the approach to systems building he describes in his book, "Modern
C++ Design." I've been intrigued by Andrei's ideas since before he
published them, as I was lucky enough to read several pre-pub drafts of his
manuscript.


JULY 18-19 WORKSHOP WITH BRUCE ECKEL

Within the C++ community, most attention has focused on Andrei's unique
implementation techniques (e.g., template templates) and their remarkable
ability to reduce compilers to rubble. I believe that Andrei's approach is
more general than the language in which it is implemented, however. I
believe it is a general approach to OOA and OOD, and that it can be
profitably applied to any OO language.

With that in mind, I approached my colleage and friend, Bruce Eckel (see
below for information on Bruce, if you are not already familiar with him),
and proposed that we jointly host a workshop on language-agnostic PBD. The
general idea is to get a bunch of software developers in a room, describe
PBD, then work through a series of real problems in small groups, applying
PBD to each of them, ultimately having participants develop an
implementation in whatever OO language they like. Unlike lectures and
seminars where the speakers speak and the attendees listen, this will be a
highly interactive event. This is not about listening to a description of
PBD and seeing how it is done, this is about doing PBD yourself, about
experiencing its strengths and weaknesses firsthand, about learning how to
map it to the implementation language of your choice.

It's also about discussing the relationship between PBD and patterns. One
of Andrei's original goals in developing PBD was to make it possible to use
C++ templates to generate implementations of GOF patterns, and his book
shows how to do that. But is it possible that PBD is itself a pattern?
Bruce leans towards the idea that it is. I'm a bit more conservative, but
there are clear relationships between PBD and the GOF's Strategy, Template
Method, and Abstract Factory patterns. One of the goals of the workshop
will be to ferret out how PBD and patterns relate, possibly concluding with
a PBD-as-pattern write-up. Who knows, participating in the workshop may
put you in on the ground floor of the identification of an important new
pattern.

Bruce and I are still working out the details of this workshop, but we know
this much: it'll be July 18-19 in Crested Butte, Colorado, and enrollment
will be limited to 30 people. For more information, take a gander at
http://www.mindview.net/Seminars/PolicyPattern/.

Here's some brief background on Bruce: Author of Thinking in C++, author of
Thinking in Java, author of Thinking in Python (available, but under
development), author of Thinking in Patterns (also under development). All
his books are freely downloadable; he has been a pioneer in electronic
publishing, too. For more on Bruce, visit his web site:
http://www.mindview.net/.


OCTOBER 31 WORKSHOP WITH ANDREI ALEXANDRESCU

But as a reader of this newsletter, there's a decent chance your primary
interest in Andrei's work is in applying it in all its templatized glory in
C++. Sure, reading Andrei's book and articles in CUJ is interesting, but
how do you go about taking the ideas behind PBD and actually putting them
into practice on real projects? I suggest you ask Andrei. Better yet,
watch Andrei. Better still, DO IT WITH ANDREI. Oh, I'll be there, too. I
like to think I know a thing or two about PBD, and by the time I'm done
with the seminar in July with Bruce, I know I will.

The workshop that Andrei and I will be hosting will be similar to the one
I'm doing with Bruce, but with two important differences. First, it's only
one day long. Second, it's for hard-core C++ developers. Namby-pamby
programmers in Java, C#, Python, etc., should attend the July workshop
unless they're prepared to jump feet-first into a thicket of angle
brackets. Like the seminar I'm doing with Bruce, this one will be based on
immersive, interactive problem-solving that results in real code. It's not
about us lecturing and you listening. It's about all of us working
together (sometimes in small groups) to take interesting high-level
problems, break them down via PBD, then implement them using your favorite
C++ compiler.

The workshop will have limited enrollment, probably around 25. (Andrei and
I haven't yet worked out the details.) Furthermore, we'll be running it as
an optional fourth day add-on for attendees of the next "THE C++ Seminar,"
(TCS3) which will be held near Portland, Oregon, on October 28-30. (It
will actually be held in Vancouver, Washington.) If you're interested,
pencil those dates in (October 28-31). Registration for this workshop
won't open until registration for TCS3 does, and that won't happen until
about July 15.

To be the first on your block to know when registration is available,
subscribe to the TCS mailing list
(http://groups.yahoo.com/group/cpp_seminar/). The opening of registration
will be announced there first, always a few days before it's announced to
my mailing list, Herb's mailing list, Steve's mailing list, etc.

I hope to see you in Crested Butte in July, in Vancouver in October, or
both!

Scott

Thursday, March 28, 2002

Possible open-enrollment seminars this summer

I am considering offering some open-enrollment courses near Portland,
Oregon, this summer, and I'd like to get some idea of which courses would
be of the greatest interest. In theory, I could offer any of the courses
listed at my Training Page (http://www.aristeia.com/training_frames.html),
but the following are the ones I'm most actively considering:

High-Performance C++ Programming
1 Day
Description at http://www.aristeia.com/high-performance_frames.html

Effective C++ Programming
5 Days
Description at http://www.aristeia.com/effective-c++_frames.html

Effective STL Programming
2 Days
Description at http://www.aristeia.com/estl/index_frames.html

An Effective Introduction to the STL
4 Days
Description at http://www.aristeia.com/eistl/index_frames.html

Cost would probably be around $500/day and would include continental
breakfast, buffet lunch, afternoon snack, and an unlimited supply of
beverages.

If you think that you or your colleagues would be able to attend a seminar,
please let me know the topics and time frame that would be best for you, as
well as the number of people. If you are interested in a topic not listed
above, please let me know that. If you think that you and your colleagues
would be unlikely to attend a seminar this summer, please do not reply to
this message.

Thanks for your help with this.

Scott

Friday, March 22, 2002

The Effective Software Development Series

For over a decade, I have tried to help bring outstanding books on software
development into existence. I've written my books and CD, I've reviewed
piles of pre-pub manuscripts for Addison Wesley, and I've encouraged
prospective authors who I thought had something important to say (perhaps
most notably Andrei Alexandrescu). Now I'm pleased to report that I'll be
acting as Consulting Editor for a new Addison Wesley book series, the
Effective Software Development Series.

I've put together a preliminary series overview, and you can find it at
http://groups.yahoo.com/group/scott_meyers/files/ESDS%20Overview.pdf
I hope you'll take the time to read it (it's only a page and a half), but
if you're in a hurry, this is the executive summary:

The Effective Software Development Series (ESDS) provides expert advice
on all aspects of modern software development. Books in the series are
well-written, technically sound, of lasting value, and tractable
length. Each describes the critical things the experts almost always do
-- or almost always avoid doing -- to produce outstanding software.

The series has just been started, and though there are things going on
behind the scenes, we're not yet in a position to announce any titles. So
why am I telling you this? Primarily to let you know that if you are
interested in writing a book that you feel would be a good fit for the
series, or if you know anybody who might be interested in writing a book
that you think would mesh well with the series, we'd love to hear about it.
Good books require good manuscripts, and good manuscripts require authors
with development insights and experiences that make them masters in their
fields. I know that many people on this mailing list are such master
developers, and I know that they know other master developers. I want to
help make the expert advice of such developers more widely available, and
I'm hoping you'll help me do that.

For information on submitting a manuscript or a proposal, feel free to
contact me (smeyers@...) or Mike Hendrickson, the AW editor for
this series (mikeh@...).

Thanks,

Scott

Monday, March 11, 2002

Updated Effective C++ CD Errata List

I just updated the Effective C++ CD errata page
(http://www.aristeia.com/BookErrata/cd1e-errata_frames.html) with the
latest batch of bug reports, as well as with a revised version of the bug
report regarding problems using IE6. That, along with the corresponding
bug report for NS6, are the most important new entries. Here's the full
list:

9/18/01 dp Under IE6, image and chunk size choices don't appear in
the navigation area, and lines don't break properly to
fit the browser window. For more information on the CD
and IE6, see href="http://groups.yahoo.com/group/scott_meyers/message/36">the message I
posted to my mailing
list on the subject
. (Despite these problems, many
people seem to feel that the CD works acceptably well
under IE6.)

11/10/01 sdm Change all URLs and email addresses that mention
awl.com to URLs/email addresses at aristeia.com
because, despite over six years of trying, the web
morons at AW are incapable of maintaining valid URLs
and email addresses.

1/19/02 ecm The CD doesn't work properly with Netscape 6.2. In
particular, images are not displayed correctly, and
chunk and image sizes are not indicated in the
navigation area.

1/22/02 ds In the magazine article "Counting Objects in C++,"
the comment in the second class definition after P55 is
incorrect: "rest of Widget" ==> "rest of ABCD"

2/ 1/02 am In the MEC++ appendix, "An auto_ptr Implemention," the
out-of-line implementation of the generalized (i.e.,
templatized) copy constructor is missing the part that
declares the template parameter U. The code should look
like this:

template<class T>
template<class U>
inline auto_ptr<T>::auto_ptr(auto_ptr<U>& rhs)
: pointee(rhs.release())
{}

Scott
--------------------------------------
Check out the *new* "THE C++ Seminar"
http://www.gotw.ca/cpp_seminar/

Thursday, March 7, 2002

My CD and Current Browsers; Leor Zolman's STL Error Decryptor

Two topics:
- Status of Effective C++ CD with contemporary browsers.
- Plug for Leor Zolman's STL decryptor -- and for Leor.


The Effective C++ CD and Contemporary Web Browsers
--------------------------------------------------

When Addison-Wesley (AW) and I developed the Effective C++ CD in 1998, the
dominant browsers were Internet Explorer 3 (IE3) and Netscape 3 (NS3),
though versions 4 were on the horizon. We developed for IE4 and NS4, and
we claimed in the marketing copy that the CD was compatible with IE4+ and
NS4+. That was true through versions 5, but in versions 6 of their
browsers, both IE and NS broke backwards compatibility, and the result is
that the CD doesn't work properly with IE6 or NS6.

AW has decided not to upgrade the CD for contemporary browsers. I'm
telling you this for two reasons. First, I want to alert you to the fact
that the CD won't work with IE6 or NS6 and there are no plans to fix this,
the marketing copy on the box and at the web site notwithstanding. (AW
will fix the marketing copy, BTW. They have no interest in lying to you.
I wouldn't continue to work with them if they did.)

Second, though fixing the CD may be beyond AW's capabilities and beyond
mine (I'm a C++ guy, not an HTML/CSS/JavaScript etc. guy), it may not be
beyond yours. AW and I both encourage you to develop patches for the CD
that will allow it to be used with current browers, including IE6 and NS6,
of course, but also browsers we never supported, such as Opera. If you
develop such patches and make them publically available, AW and I will
happily publicize them (e.g., link to them from our web sites, maybe
mention them in mailings, etc.). Our only real request is that you make
*patches* available, not complete patched copies of the CD. We'd like to
see the CD usable with current browsers, but we don't want to give the CD
away. I'm hoping you can help us out.

I apologize for the CD failing to work with contemporary browsers. We did
the best we could at the time, and I still think we produced a product to
be proud of. If you or people you know could make it possible for the CD
to be used with the latest browsers, that would make me prouder still.


Leor Zolman's STL Error Message Decryptor, etc.
-----------------------------------------------

Leor Zolman checked all the code in Effective STL before the book was
published, and he makes that code available to you at
http://www.bdsoft.com/resources/estlcode.html. In a backhanded kind of
way, however, I'm sort of responsible for his much more significant
accomplishment, because attendance at an offering of my introductory STL
course (http://www.aristeia.com/eistl/index_frames.html) inspired him to
develop a set of perl scripts to make STL error messages a lot more
readable. For example, in Item 49 of ESTL I show this error message:

example.cpp(17) : error C2440: 'initializing' : cannot convert from 'class
std::_Treestd::basic_string,class
std::allocator >,struct
std::pair,class
std::allocator > const ,class std::basic_stringstd::char_traits,class std::allocator > >,struct std::mapstd::basic_string,class
std::allocator >,class
std::basic_string,class
std::allocator >,struct
std::less,class
std::allocator > >,class std::allocatorstd::basic_stringstd::char_traits,class std::allocator > > >::_Kfn,struct
std::lessstd::basic_string,class
std::allocator > >,class
std::allocatorstd::char_traits,class
std::allocator > > >::const_iterator' to 'class std::_Treestd::basic_string,class
std::allocator >,struct
std::pair,class
std::allocator > const ,class std::basic_stringstd::char_traits,class std::allocator > >,struct std::mapstd::basic_string,class
std::allocator >,class
std::basic_string,class
std::allocator >,struct
std::less,class
std::allocator > >,class std::allocatorstd::basic_stringstd::char_traits,class std::allocator > > >::_Kfn,struct
std::lessstd::basic_string,class
std::allocator > >,class
std::allocatorstd::char_traits,class
std::allocator > > >::iterator'
No constructor could take the source type, or constructor overload resolution
was
ambiguous

Here's the same compiler output run through Leor's filter:

example.cpp(17): error C2440: 'initializing': cannot convert from
'map::const_iter' to 'map::iter' No
constructor could take the source type, or constructor overload resolution
was ambiguous

Better, no? Leor's filter(s) are freely downloadable and work with lots of
compilers and libraries (e.g., VC6-7, g++, Comeau, STLport). They can be
used from the command line or as an integrated part of the MSVC IDE. I use
them all the time, and I encourage you to try them, too. You'll find them
at http://www.bdsoft.com/tools/stlfilt.html.

As long as you're at Leor's web site, check out his training courses,
including the one called "An Effective Introduction to the STL." As you
can see at http://www.aristeia.com/training_frames.html, that's my course
:-) Leor is one of the few people I trust to teach it in my place. If
you're looking to have somebody come in and teach the STL to you or your
colleagues, I really think you should give Leor a look, especially if
you're in the Boston area. (In the interest of full disclosure, I'll point
out that if Leor teaches my course, I get a rental fee for the use of my
teaching materials. At least I'm supposed to...)

Scott
--------------------------------------
Check out the *new* "THE C++ Seminar"
http://www.gotw.ca/cpp_seminar/

Sunday, February 24, 2002

Upcoming Appearances

This mailing is all about upcoming appearances:
- March 4-6: Tutorials for the SPC in Vancouver, BC
- March 18-20: TCS2 in Boston, MA
- July 16: Keynote at the RW User Conference in Vail, CO

March 4-6 in Vancouver
----------------------
The Software Productivity Center (http://www.spc.ca/) is sponsoring two
seminars of mine. On March 4, I'll present my one-day course on maximizing
efficiency in C++. Details are available at
http://www.spc.ca/training/public/highperfc.htm. The next two days I'll be
presenting material from "Effective STL." Details are available at
http://www.spc.ca/training/public/effectivestl.htm, but unfortunately, the
details the SPC published aren't entirely accurate (though I hope they will
correct them in the next day or so). What you need to know is this: there
is no overlap in content between the efficiency course and the STL course,
so if you're interested in learning as much about using the STL as you can,
I encourage you to sign up for both courses.

Traditionally, my seminars at the SPC are pretty small (almost always under
30 people, often under 20), so these are a good chance to see me talk about
C++ in a setting where you can ask lots of questions and get plenty of
personal attention.

I apologize for the late notice of these talks (they're barely a week
away), but I hope to see you in Vancouver!


March 18-20 in Boston
---------------------
"THE C++ Seminar II" is rapidly approaching, and that means that I finally
got one of my talks done. My presentation on library design continues to
exist only in my head, but I now know exactly what I'll be talking about in
my Odds and Ends presentation. Here's the text from my overview slide:
- Templates, redundancy, default type parameters, and total specialization.
- PODs, non-PODs, arrays, and an efficiency benchmark.
- Four designs for reference counting smart pointer templates.
- spell, ispell, DWIM, and lint.
- Recommended reading
Kind of eclectic, I know, but what did you expect from a talk on odds and
ends? The recommended reading is fairly extensive, because I was
desperately looking for a way to shoehorn more material into the talk, so I
decided to include thumbnail sketches of things I didn't have time to talk
about along with pointers to places where you can get the full story.


July 16 in Vail
---------------
Rogue Wave has asked me to give a keynote address at their User Conference,
so I'll be presenting thoughts on succeeding with C++ in the real world.
You can read about the talk at
http://www.roguewave.com/corp/events/userconference/featuredspeakers.cfm,
though you'll have to scroll down beyond Bjarne to get to me.


As always, you can find a complete list of scheduled appearances at my
Seminars page, http://www.aristeia.com/seminars_frames.html.

The last few months have been busy ones, so I'll have a couple of
announcements on other topics soon. In the meantime, I hope to see you in
Vancouver next week, in Boston in mid-March, and/or in Vail in July.

Scott
--------------------------------------
Check out the *new* "THE C++ Seminar"
http://www.gotw.ca/cpp_seminar/

Friday, January 11, 2002

Schedule for TCS2; October CUJ Article Now Online

The following things are now available online:
- The schedule and presentation summary for Boston's
"THE C++ Seminar" in March
- My October CUJ article, "STL Algorithms vs. Hand-Written Loops"


THE C++ Seminar
---------------

Astonishingly, Herb Sutter, Andrei Alexandrescu, Steve Dewhurst, Dan Saks,
and I pretty much all managed to get our acts together enough to come up
with titles and descriptions for the talks we'll be giving at our second
"THE C++ Seminar" (aka "TCS2") in Boston in March. The full slate of
presentations is available at http://www.gotw.ca/cpp_seminar/02/index.htm.
(You'll probably have to scoll down a bit to get to the schedule.) I'll be
giving two talks so new, I haven't written them yet! Ahem. But in my head
they're really good. Click on over to the TCS2 page to read about them.

Regarding TCS2, I have a minor correction to the message I sent out on
December 19. In that message, I said that all the talks at the seminar
would be brand new -- never given before in public. This is accurate for
me, Herb, Andrei, and Steve, but Dan has decided to reprise one of the
talks he gave at TCS1, "Making New Friends." This was a jaw-dropper the
first time he gave it, and I suspect it'll drop more jaws this time. If
you haven't seen it, you want to. For his other presentation, Dan has
craftily refused to reveal anything about it, including whether it contains
material he's given in other public presentations. Of course, the four of
us other speakers are now convinced that Dan is preparing a killer talk
that will make the rest of us look like rank amateurs...


October CUJ Article
-------------------

The kind folks at C/C++ User's Journal have now put my October article,
"STL Algorithms vs. Hand-Written Loops" online at
http://www.cuj.com/reference/articles/2001/0110/0110b/0110b.htm?topic=reference.
This article is an excerpt from Effective STL.

Scott
--------------------------------------
Check out the *new* "THE C++ Seminar"
http://www.gotw.ca/cpp_seminar/

Tuesday, January 1, 2002

Updated Errata Lists

As part of my transition-to-a-new-year housecleaning, I've updated the
errata lists for all of my publications:

Effective C++ http://www.aristeia.com/BookErrata/ec++2e-errata.html
More Effective C++ http://www.aristeia.com/BookErrata/mec++-errata.html
Effective STL http://www.aristeia.com/BookErrata/estl1e-errata.html
Effective C++ CD http://www.aristeia.com/BookErrata/cd1e-errata.html

These lists are now comprehensive: all the bugs I know about are in those
lists.

In an ongoing effort to make this mailing list worth subscribing to, I've
listed all the new errata entries below. This mailing list is the only way
to see incremental changes to the errata lists.

Happy New Year!

Scott



EFFECTIVE C++, SECOND EDITION

DATE DATE
REPORTED WHO PAGES WHAT FIXED
-------- --- ----- ------------------------------------------------ --------
11/10/01 sdm xiii Change all URLs and email addresses that mention
xv awl.com to URLs/email addresses at aristeia.com
xvi because, despite over six years of trying, the
237 web morons at AW are incapable of maintaining
valid URLs and email addresses.

9/21/01 pxm 6-7 I should clarify that operator+ is assumed to be
a friend of String, hence has access to
String::data.

7/ 6/01 ga Items Include exception specs for operator new. This
7-8 would make parts of these Items easier to
follow. On the other hand, if I use exception
specs here, I'd need to use them in Items 9-10,
too, and also on operator delete and possibly
elsewhere. The book currently uses almost no
exception specs, and perhaps it is more
consistent that way.

7/ 6/01 ga 51 Regarding the para after the first code
fragment, the place pointed to by a and c will
actually be deleted three times, because it will
already have been deleted when b went out of
scope.

7/ 6/01 ga 63-64 The word "twist" is repeated within a short
range. Reword.

7/ 6/01 ga 64 "freestanding functions" ==> "actual
functions in the object code"

7/ 6/01 ga 182 Another common synonym for layering is
"aggregation".

10/17/01 js 202 In the first para, the phrase "begs the question"
is improperly used. Reword.

7/ 6/01 ga 203 In last sentence "PersonInfo::name" ==>
"PersonInfo::theName".

! 7/ 6/01 ga 226 In 2nd to last para, "string" isn't a template,
it's a typedef for a template. Reword.

Interesting Comments:

DATE
REPORTED WHO PAGES WHAT
-------- --- ----- -----------------------------------------------------------
7/ 3/01 jcj Item 1 Regarding the argument that using a macro to represent a
floating point literal (such as on page 13) is more space-
efficient than using a const object, jcj writes:

The [const] form is at least as efficient as the #define
because when the preprocessor replaces ASPECT_RATIO with
1.653 in one's source code, that value must be stored
somewhere in the binary machine code. Clearly the fact
that one has a floating-point literal, in addition to the
fact that I can think of no machines that have any
instructions that take floating-point immediates, it is
quite obvious that 99.9% of the time 1.653 will occupy
some typically 64-bit space in memory that will be loaded
and used just like a constant would. In fact, when you
realize that the preprocessor and the compiler may not be
very tightly coupled, the #define form would define a
floating point literal at every point ASPECT_RATIO is
used, where the const form would only have one instance in
memory no matter how many uses there are. When you have
consts that refer to types that may be allowed as
immediates in the instruction set of the compiler, it is
possible that the #define could be faster if the compiler
did not optimize in the same way, but in general I'd be
more worried about 50 floating-point literals peppered
throughout my code than 1 constant used 50 times.

9/10/01 lz 98 If you are using a library with a const-incorrect function
prototype such as that for strlen on this page, there is a
solution better than using a cast at every point in the
program where you call the incorrectly-declared function:
write a wrapper function to perform the cast, then call the
wrapper. In the example on this page, the wrapper function
would look like this:
inline strlen(const char *s)
{ return strlen(const_cast(s); }

================================================================================

MORE EFFECTIVE C++

DATE DATE
REPORTED WHO PAGES WHAT FIXED
-------- --- ----- ------------------------------------------------ --------
11/10/01 sdm 8 Change all URLs and email addresses that mention
287 awlcom to URLs/email addresses at aristeia.com
because, despite over six years of trying, the
web morons at AW are incapable of maintaining
valid URLs and email addresses.

12/20/01 pd 11 Wording similar to the following is better for
the final paragraph on this page:

References, then, are the feature of choice
when you know you have something to refer to
and when you'll never want to refer to
anything else. They are also to be used when
implementing operators whose syntactic
requirements make the use of pointers
undesirable. In all other cases, stick with
pointers.

10/ 1/01 jfn 56 In the last sentence before the code example at
the bottom of the page, "private static member
function" ==> "private member function". This
is what I hope is the final undo for the
incorrect "correction" I added on 10/4/99;
consult em's correction reported on 1/1/00 for
details.

! 12/ 5/01 at 63 The first line of prose on this page is
incorrect; section 15.1/5 of the Standard makes
clear that implementations may optimize away the
creation of a separate exception object:

If the use of the temporary object can be
eliminated without changing the meaning of the
program except for the execution of
constructors and destructors associated with
the use of the temporary object (12.2), then
the exception in the handler can be
initialized directly with the argument of the
throw expression.

However, my remark that a catch block couldn't
modify localWidget continues to be true, as does
my observation that throwing an exception is
typically much slower than passing a parameter.

3/12/01 wds 120 Bad hyphenation in 2nd-to-last para: "runt-ime"
==> "run-time".

! 3/22/01 wcm 209 RCPtr and RCIPtr behave inconsistently with
210 respect to automatically performing COW on
pointee objects. The fundamental problem is that
my fix for we's bug report of 3/4/96 above was
incorrect, and I should have realized that when I
had to "bend" the notion of constness to
implement it. As Andrei Alexandrescu noted in
his Modern C++ Design,

Smart pointer are not the best place to
implement COW, because smart pointers cannot
differentiate between calls to const and
non-const member functions of the pointee
object. (Page 165)

The responsibility for triggering COW thus rests
on smart pointer clients, and this is precisely
what I do in the non-const String::operator[] on
page 207 (note the creation of a new StringValue
object). In responding to we's bug report, I
shouldn't have modified RCIPtr. Instead, I
should have modified RCWidget::doThis to call
value->makeCopy before calling value->doThis.
That's what I'll do now, and I'll update the Item
29 source code, too.

9/22/01 sdm 222 Bad justification of last line on page.

! 10/10/01 pb 272 Notes pb, "'extern "C"' doesn't mean that name
mangling is suppressed. Rather, it means that names
should be mangled in the way that the targetted C
compiler mangles them. Some C compilers put an
underscore at the front of a name; others put an
underscore at the end; some don't change the name at
all. A name declared as 'extern "C"' should be
mangled in the same way."

Interesting Comments:

DATE
REPORTED WHO PAGES WHAT
-------- --- ----- -----------------------------------------------------------
11/24/01 iw Item 7 As it turns out, it is possible to overload the ||
and &&
operators while still preserving their short-circuit
semantics, and this is not uncommon in libraries based on
template metaprogramming. Because my objection to
overloading these operators is based on the loss of
short-circuit semantics, I don't oppose libraries that
overload them as long as they also preserve their
short-circuitedness. For an example of a library that
overloads them for good reason, check out the href="http://www.oonumerics.org/tmpw01/jarvi.pdf">Lambda Library
described at the href="http://www.oonumerics.org/tmpw01/schedule.html">Proceedings of the 2001
Workshop on C++
Template Programming
. (iw wasn't the only person to
send me the essence of this comment, but his email was the
one that inspired me to add it to the errata list.)

9/23/01 lz Item 21 One drawback to lots of overloading is that it can lead to
ambiguities. For example, if you declare both f(int) and
f(long) and a client calls f with a char or a double, the
call will be ambiguous until the client casts the char or
double to an int or long.

================================================================================

EFFECTIVE STL

DATE DATE
REPORTED WHO PAGES WHAT FIXED
-------- --- ----- ------------------------------------------------ --------
9/26/01 kh 13 The definition of contiguous-memory containers
should say that such containers are assumed to
store more than one element per dynamically
allocated chunk of memory; they are not
required to do so. In theory, both deque and
string could be implemented as arrays of pointers
to objects, for example, though no sane imple-
mentation would do things that way. (Very large
objects may be stored only one element per chunk
of memory in a deque, though one would have to
wonder why such large objects were being stored
in an STL container in the first place.)

! 11/ 5/01 sdm 61 In 2nd-to-last para, the claim that C++
guarantees that local objects are destroyed if
an exception is thrown is not quite true. The
guarantee holds only if the exception is caught.

9/27/01 lz 77 In the second section of example code, the call
to vd.resize(...) is missing the final closing
parenthesis.

! 11/ 5/01 ma 134 In last code example, "widgets.begin()+20" should
be "widgets.begin()+19".

11/ 5/01 sdm 111 In 2nd-to-last line of Item 24, "map" should be
in code font.

11/18/01 sk 160 PointAverage's constructor should list its member
initializers in the order in which the data
members are defined in the class. (Shame on me
for making this mistake, as it is the topic of
Item 13 in my href="http://www.awl.com/cseng/titles/0-201-92488-9/">Effective
C++
.)

12/26/01 jdl 211 In 2nd para, "I uses" ==> "I use".

! 10/ 4/01 rd 207 The comment above the initialization of rangeBegin
is incorrect. It should read as follows:
Initialize rangeBegin to point to the element
following the last occurrence of a value greater
than or equal to y. If there is no such value,
initialize rangeBegin to v.begin(). If the last
occurrence of the value is the last element in v,
initialize rangeBegin to v.end().

11/10/01 sdm 225 Change all URLs and email addresses that mention
228 awl.com to URLs/email addresses at aristeia.com
because, despite over six years of trying, the
web morons at AW are incapable of maintaining
valid URLs and email addresses.

Interesting Comments:

DATE
REPORTED WHO PAGES WHAT
-------- --- ----- -----------------------------------------------------------
9/24/01 mm Item 1 Sometimes, the best data structure for a problem is not in
the STL at all. mm writes that "One of the biggest misuses
that I've seen of the STL is when maps are used instead of
sparse matrix data structures. ... In many applications, a
matrix is very sparse. It is often the case that there is
just 2 to 5 entries per column, even in matrices with tens
of thousands of rows. ... There are highly efficient data
structures for doing this, and they're not very
complicated. ... There are lots of efficient algorithms
available for doing all sorts of operations on a matrix,
and there are various places on the internet (especially
www.netlib.org) that
have classes that encapsulate this."

12/22/01 sdm 37-39 Windows programmers experimenting with my
DeleteObject class should beware that there is a
Windows function with the same name. (I didn't know
what when I wrote the book.)

11/14/01 axg Item 10 One way to avoid creating allocators with per-object state
is to declare all member functions static.

11/ 5/01 sdm 60-61 An alternative to creating and using the Lock template is
to use href="http://www.cuj.com/experts/1812/alexandr.htm">Alexandrescu's and
Marginean's ScopeGuard
technique
.

11/13/01 ib 60-62 Given that manual concurrency control is a necessity, you
might consider using href="http://www.boost.org/libs/thread/doc/index.html">the cross-platform
threading library
available at Boost
.

11/12/01 sdm Item 25 Regarding the choice of basing hashed containers on
equality or equivalence, P. J. Plauger, founder of
Dinkumware, posted this to comp.lang.c++.moderated on
8/27/01:

Our latest version of the hash template classes aims for
the best of both worlds. Turns out it can hash properly
given either a strict weak ordering, as in operator
less<T>, or an inequality comparison, as in
operator
not_equal<T>. So we add a partial specialization
that
looks for SGI-style template parameters and invert the
sense of the supplied predicate. The upshot is that you
can use our hash tables as a drop-in replacement for
map/set, using a strict weak ordering, or as a drop-in
replacement for SGI-style hash_map/set, using an
(in)equality comparison.

If you're interested in the choice between equality and
equivalence for hashed containers, you might want to
href="http://groups.google.com/groups?hl=en&threadm=998828578.794072%40news.aei.\
ca&rnum=1&prev=/groups%3Fhl%3Den%26selm%3D998828578.794072%2540news.aei.ca">view
the thread from which this posting is taken
.

11/14/01 yd 243-244 yd writes: "I took your advice and turned on the
__STL_MEMBER_TEMPLATES flag in the SGI STL
configuration. However I was not able to compile, due to a
Microsoft bug (Q241949 in the MS knowledge base). MSVC6
supports member templates, but only when they are defined
inside the class body. The SGI STL has many such members
defined out-of-body. Getting it to compile would require
extensive cut-and-paste throughout. I haven't checked
STLport, but chances are it has the same problem since
it's derived from SGI STL."
I know from personal experience that some constructs
requiring member templates work with MSVC6 and STLport, so
this suggests that STLport has modified the SGI
distribution on which it is based to better work with
MSVC6. That suggests that STLport's STL may be a better
choice than SGI's, at least as regards support for member
function templates under MSVC6.

================================================================================

EFFECTIVE C++ CD

DATE DATE
REPORTED WHO WHAT FIXED
-------- --- ------------------------------------------------------- --------
9/18/01 dp The CD doesn't work properly with IE6, e.g., image and
chunk size choices don't appear in the navigation area,
and lines don't break to fit the browser window.
+---------------------------------------------------+
| Check out the *new* "THE C++ Seminar" |
| http://www.gotw.ca/cpp_seminar/ |
+---------------------------------------------------+