Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/02/11 15:50
Read: times


 
#181397 - Why is the code below cited for violation of MISRA 13.6
Why is the last code line (array element initialization) in the code below being cited for 13.6 violation by Crystal Revs MISRA checker:
"Numeric variables being used within a for loop for iteration counting shall not be modified in the body of the loop"

/*Test code for Crystal revs MISRA rule 13.6 */
typedef unsigned char uint8_t
void InitArray(void);

#define LCD_NUM_OF_COLS 2u
#define LCD_NUM_OF_ROWS	10u
uint8_t Test_Array[LCD_NUM_OF_COLS][LCD_NUM_OF_ROWS];

void InitArray(void)
	{
	uint8_t row_index = 0u;
	uint8_t col_index = 0u;	
	for (col_index = 0u; col_index < LCD_NUM_OF_COLS; col_index++)
		{
		for (row_index=0u; row_index < LCD_NUM_OF_ROWS; row_index++)	
			{
			/*	make each element of the array the char NULL	*/
			Test_Array[col_index][row_index] = 0u;	
			}	
		}
	}
 



List of 6 messages in thread
TopicAuthorDate
Why is the code below cited for violation of MISRA 13.6            01/01/70 00:00      
   Double initialisation?            01/01/70 00:00      
      Looks like bug            01/01/70 00:00      
      Sorry, forgot to mention            01/01/70 00:00      
         Now posted on MISRA forum:            01/01/70 00:00      
            Thank you            01/01/70 00:00      

Back to Subject List