22-05-2018, 01:05 PM
hmm.. in my humble opinion, I see no real danger with that code.
If the "U" is removed, that is a ok fix. If a cast is added to fix the warning then I do see danger.
How do you feel if a cast is added like:
And then sometime in the future, the VALUE is changed to 256? Unless I am mistaken, there is no compiler/tool warning? The code will continue to "work".
If the "U" is removed, that is a ok fix. If a cast is added to fix the warning then I do see danger.
How do you feel if a cast is added like:
Code:
int8_t s8a = (int8_t)VALUE;
And then sometime in the future, the VALUE is changed to 256? Unless I am mistaken, there is no compiler/tool warning? The code will continue to "work".
<t></t>