24-06-2016, 12:40 PM
There are a number of issues with this example as written.
"MISRA C:2004 Permits Deviation permits for MISRA Compliance"
which are available from the "MISRA resources" section of the MISRA forum (http://www.misra.org.uk/forum/viewtopic.php?t=1562).
The MISRA working group can not give advice on particular coding design issues.
- The line "PrErrLog = (uint16 *)Err;" violates rule 11.4.
- Cast is to uint16 not Uint16
- Pointer increment is not consistent, but varies from 0 to SizeErrLog. So the accessed items are 0, 1, 3, 6 ...
- Using a non-character pointer to access a struct whose members are of different sizes is not a good idea. Accessing using a non-character pointer is implementation dependent
"MISRA C:2004 Permits Deviation permits for MISRA Compliance"
which are available from the "MISRA resources" section of the MISRA forum (http://www.misra.org.uk/forum/viewtopic.php?t=1562).
The MISRA working group can not give advice on particular coding design issues.
Posted by and on behalf of the MISRA C Working Group