On 7/2/2010 4:45 PM, Jase Schick wrote:
> Hi Does C still need unsigned types?
Yes. (Although "unsinged" types are something of a gray area.)
> Java manages perfectly well without
> them.
No, on two counts. First, Java does in fact have an unsigned
integer type. Second, Java's lack of other unsigned types forces
the programmer into silly make-work, with concomitant opportunity
for errors.
> Do many people ever use unsigned types nowadays and if so why?
Yes. The unsigned type I personally use most frequently is
size_t, but sometimes other situations arise where I want to
represent quantities that are necessarily non-negative. Also,
there are the "bag of bits" situations when I want to view an
integer as a collection of flags or small fields (the "unsinged"
or "raw" types are perfect for this). Finally, there are mixed
situations where an integer represents a quantity but must be
manipulated as a bag of bits.
> In a
> 64-bit world, the extra range is rarely worth the hastle it seems to me.
I disagree with the implied premise, but since the argument
seems to be a pure non sequitur my disagreement scarcely matters.
--
Eric Sosman
lid