On Wed, 03 Apr 2013 07:33:05 -0400, Don <[email protected]>
wrote:
Yeah, but I think that what this is, is demonstrating what a useful
concept a positive integer type is. There's huge value in statically
knowing that the sign bit is never negative. Unfortunately, using uint
for this purpose gives the wrong semantics, and introduces these
signed/unsigned issues, which are basically silly.
Personally I suspect there aren't many uses for unsigned types of sizes
other than the full machine word. In all the other sizes, a positive
integer would be more useful.
Hm.. would it be useful to have a "guaranteed non-negative" integer type?
Like array length. Then the compiler could make that assumption, and do
something like what I did as an optimization?
Subtracting from that type would result in a plain-old int.
-Steve