Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
for loop iterator being comapred to a variable of another type
#4
Whether the code is an infinite loop will depend on the value of "var2".  If it is less than 255 there is no problem.  If examination of the code shows that "var2" and hence "var" may exceed 255 then rule 14.3 would be violated since the controlling expression will always be false.

The type of var and var2 are irrelevant. It will depends on the range of values that are held.
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread
RE: for loop iterator being comapred to a variable of another type - by misra-c - 13-02-2022, 09:52 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)