Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 10.6: \"u\" Suffix to all unsigned constants
#1
Hello

I have a disagreement with a supporter of a bigger MISRA-C:2004 rule checking tool.

He means, that the following is MISRA-C:2004 compliant :
Code:
void foo(UINT b)
{
UINT a;

a = b + 30;
}

I mean, it is not compliant . There must be \"u\"-Suffix:
Code:
void foo(UINT b)
{
UINT a;

a = b + 30[b]u[/b];
}

1. reason:
\"Rule 10.6 (required): A \"U\" suffix shall be applied to all constants of unsigned type.\"

I think, it is a clear case, when I read this rule. There is spoken from \"all\" constants of unsigned Type. So why there should be no \"u\" Suffix?




2. reason:

In \"Rule 10.1 (required):\" in MISRA-C:2004, are examples for this:

MISRA-C:2004 in Rule 10.1/10.2
Code:
... u8a + 5 /* not compliant */

... u8a + 5U /* compliant */



For me it is really a clear case, there must be a \"u\" suffix at the constant. But we need to clarify it, with an official answer for this tiny problem.

Thanks
<t>best regards,<br/>
Manni</t>


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)