![]() |
![]() |
0488 | ![]() |
||||
![]() | |||||||
| Pointers | REFERENCE - ISO:C90-6.3.6 Additive Operators - Constraints | ||||||
An addition or subtraction operation is being performed on an expression of pointer type. Message 0488 is generated when 2 pointers are subtracted or when an integer value is added or subtracted from a pointer value. An exception to this rule occurs when the integer value 1 is added or subtracted fron a pointer; in this particular case, message 0489 is generated instead. For example:
/*PRQA S 510,2017,3120,3199,3203,3408,3447 ++*/
extern int *px;
extern int *qx;
extern void foo(void)
{
long s;
px = px + 2; /* Message 0488 */
s = qx - px; /* Message 0488 */
px = px + 1; /* Message 0489 */
++px; /* Message 0489 */
qx--; /* Message 0489 */
}
MISRA C:2012 Rules applicable to message 0488:
| Rule-18.4 (Advisory) | The +, -, += and -= operators should not be applied to an expression of pointer type |
See also:
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index | Contents |