|
|
|
|
|
by hashmash
247 days ago
|
|
Sometimes I'd like to have unsigned types too, but supporting it would actually make things more complicated overall. The main problem is the interaction between signed and unsigned types. If you call a method which returns an unsigned int, how do you safely pass it to a method which accepts a signed int? Or vice versa? Having more type conversion headaches is a worse problem than having to use `& 0xff` masks when doing less-common, low-level operations. |
|
The same way you pass a 64-bit integer to a function that expects a 32-bit integer: a conversion function that raises an error if it's out of range.