Is the conversion from '(signed) -1' to 'unsigned long' standardized? [duplicate]
问题 This question already has answers here : What happens if I assign a negative value to an unsigned variable? (5 answers) Closed last year . In this answer, you can find this comment: Strictly speaking the bit representations of the two numbers before conversion being the same doesn't matter. Even with 1's complement or signed magnitude representations, the conversion of (signed) -1 to unsigned long will always result in ULONG_MAX . (The bit pattern will be the same after conversion of course).