24-04-2006, 12:00 PM
Hi
Question about Rule 12.9: The unary minus operator shall not be applied to an expression whose underlying type is unsigned.
1. Is this incorrect?
2. Shows this example, what the rule 12.9 mean?
4. Is this correct? (a = int)
5. Is this correct, too? (a = uint)
6. I think it it is correct to rule 12.9, but breach 10.1. Right?
7. Have somebody good examples for rule breaks? And how to solve it?
best regards,
Manni
Question about Rule 12.9: The unary minus operator shall not be applied to an expression whose underlying type is unsigned.
Code:
uint32_t u_int_a;
uint32_t u_int_b;
u_int_a = -u_int_b;
2. Shows this example, what the rule 12.9 mean?
4. Is this correct? (a = int)
Code:
uint32_t int_a;
uint32_t u_int_b;
u_int_a = -(int32_t)u_int_b;
5. Is this correct, too? (a = uint)
Code:
uint32_t u_int_a;
uint32_t u_int_b;
u_int_a = -(int32_t)u_int_b;
7. Have somebody good examples for rule breaks? And how to solve it?
best regards,
Manni
<t>best regards,<br/>
Manni</t>
Manni</t>