I think one of the things we don't appreciate enough about Rust is how it goes out of its way to say "hey! looks like you're trying to use a C idiom. Here's how we say that in our language." Anyway we spell `-1` as `!0`, which is something we may want to tell C programmers.
-
-
Why is -1 an unsigned underflow in this case? I would think it's just reinterpreting the bits to mean !0, but I also haven't gotten a perfect bit twiddling mental model yet. I can see 0-1 doing it, but not -1 somehow
-
the signed -> unsigned conversion is defined to use unsigned's wrapping rules. -1 becomes UINT_MAX, -2 (-1 - 1) becomes UINT_MAX - 1, etc
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.