|Synopsis:||Expressions containing multiple function references should be avoided due to the possibility of side-effects occurring in an undefined order.|
|For all but a few constructs in C, Standard C does not define the evaluation order even where there may be side-effects. Reliance on them can create problems which are very expensive to track down.
Even something as simple as two function references in the same expression can lead to problems.x = i++ + a[i]; /* WRONG - 2 side effects x assigned and i changed */ x = i + a[i]; /* RIGHT */ i++;
x = f() + g(); /* CAUTION - if f and g both modify and access the same externally visible identifier, big problemsmay result. */ t = f(); x = t + g(); /* SAFE, but may lead to expressions becoming hard to understand. */