side effects in argument lists
Mikael Pettersson
mikpe at mina.liu.se
Mon Nov 28 17:39:56 AEST 1988
Consider the following program:
---snip---
#include <stdio.h>
int count = 0;
void bletch(int junk) {
printf("count == %d\n", count); /* 0 or 1 ? */
}
main() {
bletch(count++);
exit(0);
}
---snip---
This program exemplifies the situation where the behaviour of the
callee depends on whether the caller has completed *all* of the
side effects from evaluating the arguments of the call or not.
Q: what sayeth the dpANS about this?
If count++ _is_defined_as_ (++count, count-1) then I guess things
are cool, but what if the definition is less strict?
/Mike
--
Mikael Pettersson ! Internet:mpe at ida.liu.se
Dept of Comp & Info Science ! UUCP: mpe at liuida.uucp -or-
University of Linkoping ! {mcvax,munnari,uunet}!enea!liuida!mpe
Sweden ! ARPA: mpe%ida.liu.se at uunet.uu.net
More information about the Comp.lang.c
mailing list