4 ms·
My only beef with unsigned types in Java is when working with external systems that _actually have_ them and converting everything correctly. The 12 or so times
by exabrial 4y ago
My only beef with unsigned types in Java is when working with external systems that _actually have_ them and converting everything correctly. The 12 or so times in my career where I've had to write or implement protocols on that low of a level might have been a pain, but otherwise I never once have missed them.
- pavlov 4y agoPersonally I think that protocol description languages should support uint63 and int53 natively. Uint63 can be promoted to whatever is the largest native integer type on most systems, and int53 fits into a JavaScript number. It would be useful to have explicit checks for these values on the protocol level.
- BoorishBears 4y agoI mentioned above, but in Kotlin going from a packed C struct to JVM: Mapping for C type to ByteBuffer call: uint16_t -> getShort().toUShort() uint32_t -> getInt().toUInt() int32_t -> getInt() It's not the most ergonomic set of calls, but definitely limits the error prone nature of it all since if you try to pass an Int into a function that needs a UInt, you'll get a compiler error