| ▲ | einpoklum 11 hours ago | |
> Unsigned ints have no “negativity” semantic. They do. The code:
is well-defined in C and C++. See this discussion on StackOverflow for spec text and reference: | ||
| ▲ | throwaway894345 9 hours ago | parent [-] | |
That’s not a negativity semantic, it’s the behavior of the “-“ operator. If you print y or compare it to zero you will see that the result remains positive. Unsigned integers by definition have no negative semantic, hence the name. | ||