[previous] MISRA C:2012  Rule-11.8:  (Required) [next] A cast shall not remove any const or volatile qualification from the type pointed to by a pointer

Example Code:


#pragma PRQA_MESSAGES_OFF 2982,3210,3408,3447

#include "misra.h"
#include "m3cmex.h"

extern const    uint8_t * pcuc;
extern volatile uint8_t * pvuc;
extern          uint8_t * pucm;

extern int16_t rule_1108( void )
{
    pucm = (uint8_t *)pcuc;                /* 0311 */
    pucm = (uint8_t *)pvuc;                /* 0312 */

    return 0;
}


QAC messages that encompass this guideline:

0311 Dangerous pointer cast results in loss of const qualification.
0312 Dangerous pointer cast results in loss of volatile qualification.



(c) The Motor Industry Research Association, 2012
QA C Source Code Analyser 8.1.2
MISRA C:2012 Compliance Module 1.0
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents