05-12-2014, 09:04 AM
pcpi is a "pointer" to const qualified object of type "pointer to int"
pcpci is a "pointer" to const qualified object of type "pointer to const int"
The unqualified object type for pcpi is "pointer to int", which is different to the unqualified object type of pcpci which is "pointer to const int".
The phrase "unqualified types" only refers to the top-level const/volatile qualification. See
http://www.misra.org.uk/forum/viewtopic.php?t=1293 for further discussions on unqualified pointer types.
The rule's rationale applies to more issues than misalignment as mentioned in the second paragraph of the rationale. Such an example could be
pcpci is a "pointer" to const qualified object of type "pointer to const int"
The unqualified object type for pcpi is "pointer to int", which is different to the unqualified object type of pcpci which is "pointer to const int".
The phrase "unqualified types" only refers to the top-level const/volatile qualification. See
http://www.misra.org.uk/forum/viewtopic.php?t=1293 for further discussions on unqualified pointer types.
The rule's rationale applies to more issues than misalignment as mentioned in the second paragraph of the rationale. Such an example could be
Code:
const int ci = 10;
const int **ppci; /* pointer to pointer to const int */
int *pi;
ppci = (const int **)π
*ppci = &ci; /* pi now points to const int */
*pi = 0; /* undefined - attempt to update a const int */
Posted by and on behalf of the MISRA C Working Group