:? unique? (was Re: cond. op. on ='s LHS)
Wayne Throop
throop at aurs01.UUCP
Wed Feb 27 05:50:05 AEST 1991
> rh at smds.UUCP (Richard Harter)
> C follows the "one, two, many" approach to terms. You can say:
> OP TERM --x *x -x &x etc
> TERM OP x++ x-- etc?
> TERM OP TERM x+y x-y x*y etc
> TERM [OP TERM]... f(x,..) x,y... etc
I'm not sure I follow Richard's point. In what relevant way is
x+y+z
different from
x,y,z
so as to justify calling the former a case of "two" and the latter
a case of "many", based on operator?
IMHO, C operators fall into cases one, two, three, and many. The
only case of "three" is ?:, and the only case of "many" is f().
> It occurs to me, offhand, that post decrement and post increment are
> the only instances of TERM OP. Does this mean that post incrementing is
> ugly? :-)
Well.... yes, actually. In the sense that it is made available as
a special case hack to what (if present at all) ought to be made
a general case, similar to the operate-and-assign operators.
Compare, for example, C's assignment operator suite along with the
pre-and-post-mumble-ment operators to LISP's LET bindings, along with
PROG1 and PROGN. (uh... just the idea, and ignore the awful names) In
LISP, one can at least synthesize any sort of preincrement or
postincrement on the fly, in any valueish context. In C, you can do
some of them, and the others must be done by assignment to a temporary,
and hence can't be uttered neatly inside expressions.
On the other hand, I don't suppose the post-mumble-ment operators
are any uglier than quirky special cases in other Algol-related
languages, sigh. At least Algol relatives generally don't have
the historical naming baggage of LISP relatives. CAR. CDR.
PROGN. LET*. Shudder.
Wayne Throop ...!mcnc!aurgate!throop
More information about the Comp.lang.c
mailing list