3 ms·
I don't follow this argument - the only thing I can think of that's MORE confusing than mixing signed + unsigned types is passing around values of the signed ty
by al2o3cr 4y ago
I don't follow this argument - the only thing I can think of that's MORE confusing than mixing signed + unsigned types is passing around values of the signed type that are "supposed to be interpreted as unsigned", like "Long.divideUnsigned" does.
https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html#divideUnsigned-long-long- https://docs.oracle.com/javase/8/docs/api/java/lang/Long.htm...
So in a program that uses this a lot, a reader can never tell reliably if a value typed "long" is signed or unsigned and the compiler can't catch a mistake like using "divideUnsigned" and then printing the result without using "toUnsignedString"...