Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
10.3. Casting to a narrower type
#2
MISRA-C meeting 23-8-2006.

Code:
s16c = (int16_t)(s32a * s32b);

Having made the cast explicit, it is still necessary to be sure that the cast results in no loss of infomation.

The cast makes it clear this is a 16 bit constraint.

Implicit narrowing casts are prohibited by 10.1.
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)