From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-06-08 11:00:19
From: "Douglas Gregor" <gregod_at_[hidden]>
> > FWIW, I tend to agree with Darin that the if(f), f = nil, f == nil
> > constructs, while useful, are not strictly necessary (considering the
> > problems they introduce) - the explicit empty(), clear() methods are
> Which problems do they introduce? Unless there are serious problems with
> nil/null type (such that it won't be adopted), I'm not sure I see any
> problems with the operators.
The implicit conversion is quite dangerous. It enables code like this:
f + 4;
f - f;
to compile. I'd expect comparisons of the form f < f, f > f, etc to also
work, but some compilers (Intel, MSVC) don't agree with me on this; g++
2.95.2 and bcc32 5.5.1 do.
As for the f = nil syntax... I do prefer the f = 0; syntax when f is a smart
pointer; however, f = nil and f.clear() are equal to me. Neither is an
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk