Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Double casting to bypass 11.4?
#3
Does anybody have any comments on the following (as far as I can tell) MISRA compliant code:

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 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
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)