I have already bought the C11 Standard and am still studying the document, getting a feel for its structure, organization and language. So I'm still struggling a bit to feel confident about some answers to my questions.
One of them pertains to integer implicit conversion and the role it plays on an expression of this kind. In particular, I can't fully decide if the following code is defined or undefined from reading the Standard text below.
Code:long n = LONG_MIN; unsigned long m = -n;I understand the promotion takes place before the unary minus sign is applied. So the very first operation is m promotion to ulong. But I can't then reconcile that with the text on 6.3.1.3 and what happens next when the unary minus sign brings the result back to a negative value outside m range.6.3.1.3(2)
Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or subtracting one more than the maximum value that can be represented in the new type until the value is in the range of the new type.
6.5.3.3(3)
The result of the unary - operator is the negative of its (promoted) operand. The integer promotions are performed on the operand, and the result has the promoted type.