![]() |
![]() |
0400 | ![]() |
||||
![]() | |||||||
| Explicitly undefined | REFERENCE - ISO:C90-6.3 Expressions | ||||||
An object is being modified more than once between sequence points and the result will be undefined. In C the order in which side effects are performed is not well defined. If an object is modified more than once between two sequence points, the C language does not define in which order the 2 updates are performed. Message 0400 is generated when an object is definitely modified more than once between sequence points. Definite sources of modification occur in assignment operations and increment and decrement operations. In the example below, the expression on the right hand side of the assignment operation will evaluate to 10. The statement requires that "x" shoud be modified twice; once with an increment operation and once by assignment. Unfortunately, the C language does not specify which of these updating operations should be performed first. A compiler may choose to assign the value 10 and then increment it to the value 11. Alternatively, it may choose to increment the value of x to 3 and then update it by assignment to the value 10.
/*PRQA S 2017,3120,3199,3204,3227,3408,3440 ++*/
extern void foo(void)
{
int x = 2;
int y = 5;
x = y * x++; /* Message 400 */
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |