Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there any MISRA rule to find this sideeffect??
#3
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>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)