[comp.lang.c] :? unique?

barmar@think.com (Barry Margolin) (02/24/91)

In article <334@smds.UUCP> rh@smds.UUCP (Richard Harter) writes:
>As far as the ?: syntax is concerned I would like to reiterate the point
>that it is dissimilar to other C constructs (other than that it uses still
>more special symbols.)  All other operators which use punctuation (with
>the exception of ->) are either unary or binary operators.

What about the function call operator?  It takes an arbitrary positive
number of parameters.
--
Barry Margolin, Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar

john@iastate.edu (Hascall John Paul) (02/24/91)

In article <1991Feb23.215538.10212@Think.COM> barmar@think.com (Barry Margolin) writes:
}> ...  All other operators which use punctuation (with
}>the exception of ->) are either unary or binary operators.

}What about the function call operator?  It takes an arbitrary positive
                                                               ~~~~~~~~
}number of parameters.

   Non-negative.         ;-)

--
John Hascall                        An ill-chosen word is the fool's messenger.
Project Vincent
Iowa State University Computation Center                       john@iastate.edu
Ames, IA  50011                                                  (515) 294-9551

john@iastate.edu (Hascall John Paul) (02/25/91)

In article <1991Feb24.085322.7800@Think.COM> barmar@think.com (Barry Margolin) writes:
}In article <1991Feb24.022225.10838@news.iastate.edu> john@iastate.edu (Hascall John Paul) writes:
}>In article <1991Feb23.215538.10212@Think.COM> barmar@think.com (Barry Margolin) writes:
}>}What about the function call operator?  It takes an arbitrary positive
}>}number of parameters.

}>   Non-negative.         ;-)

}I stand by my original statement.  The function call operator always has at
}least one parameter: a function or function pointer.

 I stand by my original statement.  ... but it has ...
 ... at least one operand: a function pointer.

  Followups to alt.nomenclature.nit-pick    ;-)

John
--
John Hascall                        An ill-chosen word is the fool's messenger.
Project Vincent
Iowa State University Computation Center                       john@iastate.edu
Ames, IA  50011                                                  (515) 294-9551

rh@smds.UUCP (Richard Harter) (02/25/91)

In article <1991Feb23.215538.10212@Think.COM>, barmar@think.com (Barry Margolin) writes:
> In article <334@smds.UUCP> rh@smds.UUCP (Richard Harter) writes:
> >As far as the ?: syntax is concerned I would like to reiterate the point
> >that it is dissimilar to other C constructs (other than that it uses still
> >more special symbols.)  All other operators which use punctuation (with
> >the exception of ->) are either unary or binary operators.

> What about the function call operator?  It takes an arbitrary positive
> number of parameters.

To say nothing of the comma operator or the switch statement.  :-)

However 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

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?  :-)


-- 
Richard Harter, Software Maintenance and Development Systems, Inc.
Net address: jjmhome!smds!rh Phone: 508-369-7398 
US Mail: SMDS Inc., PO Box 555, Concord MA 01742
This sentence no verb.  This sentence short.  This signature done.

kers@hplb.hpl.hp.com (Chris Dollin) (02/26/91)

Re "how many operands", Richard Harter writes:

   To say nothing of the comma operator or the switch statement.  :-)

Presumably the smiley is because Richard knows full well that both the comma
operator and switch statement have exactly two operands .....
--

Regards, Kers.      | "You're better off  not dreaming of  the things to come;
Caravan:            | Dreams  are always ending  far too soon."

throop@aurs01.UUCP (Wayne Throop) (02/27/91)

> rh@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