More Re: Function Argument Evaluation argument

Roy Johnson rjohnson at shell.com
Tue Apr 2 06:21:43 AEST 1991


I understand that the comma operator is a sequence point.
If we use the comma operator as a sequence point between evaluations:

   int v=1;
   printf("%d %d\n", (1, v), (1,v++));

This can print
	1 1
or
	2 1
if I understand it right, which I very well may not.

Similarly,

   char *x="foo", *y="bar", *p;
   p=x;
   printf("%s %s\n", (1, (p=y)), (1, p));

can print

	foo bar
or

	bar bar

Do I win?  8^)
--
======= !{sun,psuvax1,bcm,rice,decwrl,cs.utexas.edu}!shell!rjohnson =======
Feel free to correct me, but don't preface your correction with "BZZT!"
Roy Johnson, Shell Development Company



More information about the Comp.std.c mailing list