≈ the.bay.news

Type compatibility of number operations make no sense

Ziggit
Type compatibility of number operations make no sense
Why are signed and unsigned integers inherently incompatible with each other? I find myself adding say a usize and an i8 together often. Why are these two incompatible? Like sure, you could argue “oh, its cuz if the usize value is less than 255 it’ll underflow”, and the compiler wants to protect you from that happening. But the compiler is not doing anything but adding more work to do. I need to add a whole @as(T, @intCast()). The compiler is not protecting against anything here. I’d argue thi...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.