05-05-2008, 07:33 PM
Is the following acceptable under 10.5?
[code]
unsigned char u = 1u;
(unsigned char) u
[code]
unsigned char u = 1u;
(unsigned char) u
Welcome to the new MISRA discussion forum, if you were previously a member of our forums you may need to reset your password.
Left Shifts and Castings
|
05-05-2008, 07:33 PM
Is the following acceptable under 10.5?
[code] unsigned char u = 1u; (unsigned char) u
06-05-2008, 08:55 AM
Yes that is correct. The result must be typecasted in order to conform with rule 10.5.
The typecast to unsigned char in the first example will not have any effect at all. The typecast operator has higher priority than
<t></t>
24-09-2008, 08:47 AM
[code]
uint8_t u =1; uint8_t v; uint8_t w; v = u
Posted by and on behalf of the MISRA C Working Group
|
« Next Oldest | Next Newest »
|