Function Argument Evaluation
Ed Gould
ed at mtxinu.COM
Fri Mar 29 05:46:27 AEST 1991
>I would be very interested in seeing a program whose behavior
>was *not* undefined, yet could arbitrarily produce either of two
>drastically different outputs depending solely on the unspecified
>order of evaluation.
Will this do?
foo() {
int v = 1;
printf("%d %d\n", v, ++v);
}
It may print either
1 2
or
2 2
depending solely on order of evaluation. Are there any other
things here that make this program's behavior undefined? I
think not.
--
Ed Gould mt Xinu, 2560 Ninth St., Berkeley, CA 94710 USA
ed at mtxinu.COM +1 415 644 0146
"I'll fight them as a woman, not a lady. I'll fight them as an engineer."
More information about the Comp.std.c
mailing list