From: James Curran/MVP (jamescurran_at_[hidden])
Date: 2001-10-24 13:54:10
I'm not sure I buy that in this case. Shared_ptr has an edge
condition at zero by its very nature. Doing something at count =
0xFFFFFFFF that should have been done at count = 0x00000000 is just
wrong, and considering 0xFFFFFFF a small negative number rather than a
large positive number doesn't make it any more or less wrong.
So, by making the count unsigned, we would be formalizing the
precondition that is already there.
Date: Tue, 23 Oct 2001 22:20:54 -0700
From: Darin Adler <darin_at_[hidden]>
Subject: Re: shared_ptr doesn't use unsigned reference count?
That leaves us with reason 3, clarity.
Many C and C++ programmers prefer to avoid the pitfalls of
arithmetic -- having the edge of the numeric range right next to
0 makes it easier to write incorrect code. These programmers don't
consider clarity reason enough to use an unsigned type, and only use
an unsigned integer type when either reason 1 or 2 applies.
Let me turn your question around.
Can anyone tell me a practical advantage that would result from
shared_ptr's pn member be unsigned?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk