You can implement C in completely different ways. For example, I like that signed overflow is UB because it is trivial to catch it, while unsigned wraparound - while defined - leads to extremely difficult to find bugs.
replies(4):
See here for that in action, as well as one way to test it that does work: https://godbolt.org/z/sca6hxer4
If you're on C23, uercker's advice to use these standardized functions is the best, of course.