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.
-
-
taking off my jokes face, or as i guess you could call it, my "bit mask", i think `!0` and `uN::MAX` are each the best in their domains, but they are nevertheless in different domains. if you work with numeric integers, use `MAX`; if you work with bitwise registers, use `!0`
-
I do actually use `::MAX` in
#bitvec, since constants can propagate through traits and literals cannot, but in my concrete code, `!0` more clearly indicates "a register with all bits set", while `::MAX` only indicates "an integer that cannot be exceeded" - 4 more replies
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.