What can I do to avoid MISRA giving this error for the code below? I tried casting with (unit16_t). But then it didn\'t allow an explicit conversion.
Illegal implici
If you try casting your operands using C-style casting, you might just give your tool something else to complain about. So, instead of doing this:
uint16_t basic_units = (uint16_t)rate * (uint16_t)percentage;
You may need to do this:
uint16_t basic_units = static_cast(rate) * static_cast(percentage);