Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-10-30 02:25:26


>"Dave Gomboc" <dave_at_[hidden]> wrote in message
news:002b01c39ea4$8595fb90$fb01a8c0_at_cyborg...
> > so where should I use unsigned?
> >
> > -Thorsten
>
> Use unsigned numeric types whenever negative values aren't
> permitted or don't make sense.
>

When I read up on the matter in these theads

http://groups.google.com/groups?hl=da&lr=&ie=UTF-8&threadm=b1qvbv0uclbs1vvacfun014plrdbo87boe%404ax.com&rnum=3&prev=/groups%3Fq%3D%2Bunsigned%2Bintegers%2BC%252B%252B%26hl%3Dda%26lr%3D%26ie%3DUTF-8%26selm%3Db1qvbv0uclbs1vvacfun014plrdbo87boe%25404ax.com%26rnum%3D3

http://groups.google.com/groups?hl=da&lr=&ie=UTF-8&threadm=3BFEEAE8.196852BD%40bawi.org&rnum=1&prev=/groups%3Fselm%3D3BFEEAE8.196852BD%2540bawi.org

I don't agree. AFAICT, we should stick to signed and check ranges.
>From what I can remember in the threads:

1) some sompilers might warn, not all will.
2) the burden of the checking functions precondition is put onto the user
3) a range check can still be done on the unsigned type, but it must be
converted to a signed first
4) we can't get rid of signed, but we can get rid of unsigned in many places
5) mixing signed and unsigned has many pitfalls
6) overloading on unsigned can easier lead to ambiguity than signed
7) the mixin of signed an unsigned is a problem for beginners
8) range checks are mostly not critical for program performance
9) experts advocate signed (Bjarne Stroustrup, Francis Glassborrow, James
Kanze, Scott Meyers)

I would be good if boost could agree on some guidelines for this.

best regards

Thorsten


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