Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
10.3 Clarification on assigning unsigned literal to signed
#3
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:
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>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)