Boost logo

Boost :

From: AlisdairM (AlisdairM_at_[hidden])
Date: 2001-10-24 14:34:16


-----Original Message-----
From: Peter Dimov [mailto:pdimov_at_[hidden]]
Sent: 24 October 2001 19:55

> There is no precondition; there is a count >= 0 invariant. It is
assert'able
> with a signed count, and not assert'able with an unsigned.

Normally, I favour use of the unsigned int if the data is logically
meaningless with a negative value, if gives me one less thins to test. In
the case of shared_ptr that would have been my original implementation, but
I feel that to change something as tried, tested and *trusted* as shated_ptr
you need a good reason rather than a personal preference.

The idea of the assert may actually swing this argument away from me! The
value of 0xffffffff is either one massively shared pointer, or an underflow
and so an error that needs detecting. By using a signed long, there is a
very easy test to use in an assert, whereas going signed means either using
an arbitrary upper limit trying to detect underflows, or ignoring the issue.

Unless someone comes up with a good reason that we need such a large range,
my stance has moved in favour of signed-with-assert and I will have to
reconsider how I approach similar issues in my own code now!

Thanks for clarifying this for me Peter :? )

AlisdairM


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