uint is NOT just a positive number
Kagamin
spam at here.lot
Wed Oct 7 01:15:15 PDT 2009
Some people used to use unsigned integers as 'mere' non-negative numbers, but they're actually not numbers from range, they're numbers from entirely different algebra. And - yes - this causes subtle bugs. Recent introduction of integer range promotions works hard in hiding those bugs, so they manifest only in very rare corner cases.
Ever wondered wheter a-=b and a+=-b equivalent? In most cases they are, except for one. Do you remember? uint is not propagated to long. I've hit it recently. It's exactly because unsigneds are not just non-negative numbers. So it's pain to see their wide use as numbers for which sign-sensitive arithmetic operations are meaningful.
More information about the Digitalmars-d
mailing list