07-09-2009, 08:53 PM
Does anybody have any comments on the following (as far as I can tell) MISRA compliant code:
I also think there is a typo in the second bullet point of paragraph 2 in section 6.11 which confuses the issue.
I think the 0 is missing from the definition of a null pointer constant, unless it is talking about a pointer to void!
Bill Forbes
Code:
uint8_t u8 = 0U ;
uint8_t * ptr_u8 = &u8 ;
void * ptr_nothing = ptr_u8 ; /* Rule 11.2 compliant */
uint16_t * ptr_u16 = ptr_nothing ; /* Rule 11.4 compliant - no cast */
uint16_t u16 = *ptr_u16 ; /* What value is u16 ? !! */
I think the 0 is missing from the definition of a null pointer constant, unless it is talking about a pointer to void!
Bill Forbes
<t></t>