Aside:
You’ve got it mixed up (unless C and C++ differ in this point, because I checked C++ spec, not C one; I wouldn’t expect them to differ though)!
C++ requires that signed to unsigned conversion is done modulo respective generator like the rest of the unsigned math, i.e. (unsigned)-1 is equivalent to 0u - 1u.
On the other hand, bitwise negation on signed value is implementation defined. If signed values are represented in any other way than two’s complement, ~0 != -1. But the signed → unsigned conversion is defined in terms of numeric values, not bit patterns. Therefore (unsigned)~0 will not result in maximal value for unsigned on platforms with different representation than two’s complement.