From clc-wiki
Unspecified behaviour is defined in ISO C99 in section 3.4.4, as:
behavior where [the standard] provides two or more possibilities and imposes no further requirements on which is chosen in any instance
EXAMPLE An example of unspecified behavior is the order in which the arguments to a function are evaluated.
In general, the careful programmer will avoid writing any code that depends upon the outcome of aspects of C that have unspecified behavior, as the code can easily behave differently when ported from one platform to another, or even when it is built with a different compiler and toolchain on the same platform.
It is even possible that the behavior could change from revision of a compiler to the next, although that is less likely to occur in practice.
Quick examples
The order in which parameters are evaluated
#include <stdio.h> int a(void) { return puts("A called"); } int b(void) { return puts("B called"); } void c(int p1, int p2) { } int main(void) { c(a(),b()); return 0; }
could print
A called B called
or
B called A called
However, it could not interleave the two lines.
See also
References
- ISO C99 Standard, 3.4.4