Boost logo

Boost :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2006-02-16 09:07:01


Fred Bertsch wrote:

...

>> After the long debate about RAII I don't know if this solution would
>> be accepted by boost members or only compile-time configuration is
>> accepted.

...

> Ion is proposing a solution that solves many of the problems with a
> two stage construction process. It is still possible to use the
> constructors with std::no_throw and get an invalid state. I shouldn't

My vote would be to only have the RAII type. My second would be that they be
separate types in separate headers so that users of the properly designed
RAII type not be concerned with the sins of the two-phase type. :) And of
course the two-phase type should come with the appropriate warning labels,
and be more difficult to find.

> comment on the no-exceptions, embedded world that Ion is hoping to
> placate with his strategy, but in the world where exceptions are
> possible, it should be easy to tell that you're tripping over
> something nasty when you pass std::no_throw into a constructor. It
> seems to me that this should be good enough even if it's not ideal.

I concur with Dave Abrahams' reasoning here. I work in an evironment of
primarily C programmers who venture into C++ now and then. I'd prefer to
have them come to me and ask how to add an RAII shmem data member and
initialize it. Rather than wade through their code trying to fix some
totally unrelated problem, just to see they have fallen prey to two-phase
initialization issues.

Jeff Flinn


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk