![]() |
![]() |
3440 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Operations | REFERENCE - ISO:C90-6.3.2.4 Postfix Increment and Decrement Operators, ISO:C90-6.3.3.1 Prefix Increment and Decrement Operators | ||||||
The value resulting from a ++ or -- operation has been used. The ++ and -- operators are special in that they don't just return a value, they also generate side effects - by modifying their operand. If the result value is used, there are some particular dangers:
/*PRQA S 506,2017,3199,3203,3227,3408,3447 ++*/
extern void f1(int p);
extern void foo(int n, int *p)
{
int r;
++n; /* OK */
(*p)--; /* OK */
r = ++n; /* Message 3440 */
f1(r++); /* Message 3440 and 3441 */
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |