06-08-2018, 09:46 AM
sprabhakars Wrote:I just re edited the code for better clarity -
I am not sure, if this potential problem is categorized under any MISRA rules??
Code:#include
int main()
{
unsigned char var1 = 0;
unsigned short var2 = 300;
while (var1 < var2)
{
var1++;
}
(void)printf("program completed \n ");
return 0;
}
The variable var2 shall be greater than var1(var1 is a char and var2 is short) and may not breaks out of this while the while condition never fails.
I run this with PC-Lint and Parasoft's MISRA checker, both doesn't find any error with this portion of code.
<t></t>