Conversation

This Tweet was deleted by the Tweet author. Learn more
This Tweet was deleted by the Tweet author. Learn more
From my perspective, regardless of how people want to handle unintended overflow, explicit intended overflow for new languages and new code in older languages can reach consensus. For signed in C it's barely even a discussion since you can't rely on it while being portable.
1
1
Should only use -fwrapv as a way of slightly hardening code with GCC. For Clang, it actually works properly, and you could use it as a language extension where signed overflow always wraps, but I don't think that's a good approach vs. marking intended overflows anyway.
It's noisy, but C doesn't support custom arithmetic types like Rust. Swift has wrapping operators. Wrapping is only commonly used for unsigned integers though. It's rarely ever wanted for signed integers, and is mostly a quirk of hardware rather than something actually used.
1
2
Show replies