unary +

KW Heuer kwh at bentley.UUCP
Sat Mar 15 02:05:13 AEST 1986


In article <1195 at mmintl.UUCP> mmintl!franka (Frank Adams) writes:
>I have a suggestion for the C standardization committee.  Rather than using
>a unary + operator to force the order of evaluation, why not use a different
>kind of parentheses; specifically, square brackets?  [ example deleted ]

Well, if you make any sort of syntax error on a line containing brackets,
you're likely to get a confusing message from the compiler.  I'm not sure
I like either notation, but +() seems simpler to me.

Here's a more fundamental question.  Under what circumstances would you
use this feature anyway?  If my understanding is correct, it only forces
the compiler to respect the parentheses; it does not force the enclosed
expression to be evaluated before anything else, so
	y[i] = x[i++];
or
	case '-': push(pop() - pop());
(where pop() has a side-effect) are unpredictable even with +().



More information about the Comp.lang.c mailing list