Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!ames!elroy!gryphon!joe From: joe@gryphon.COM (Joseph Francis) Newsgroups: comp.lang.c Subject: Re: printf() and commutative operations problem Keywords: C printf Message-ID: <15580@gryphon.COM> Date: 8 May 89 07:27:07 GMT References: Reply-To: joe@gryphon.COM (Joseph Francis) Organization: Trailing Edge Technology, Redondo Beach, CA Lines: 19 The problem having been well characterized, why not a new specification for evaluation. The bitwise & operator is well-known to be commutative so it is left to the compiler to rearrange subterms for optimal evaluation, and therefore the 'deadly' getchar() used as getchar() & getchar() (useless, but similar to the original problem) combined with something else can have unpredictable side-effects. However, the getchar() && getchar() will always be L-R evaluated. So, for function definition, why not something like f(a, b; c; d, e, f) either in the prototype or at invocation which guarantees the ordering of b->c->d and leaves the others unspecified; mixed commtative and non-commutative argument delimiting. I realize, of course, this could be controlled with macros, something hideous like #def f(A,B,C) { argtype a,b,c; a=A; b=B; c=C; g(a,b,c) } or with better coding, but why not allow more sequencing control, if you allow it with && and other operators? -- joe@gryphon ...!elroy!gryphon!joe but jojo to my beeeest frieeeends.