syntax for unary assignment operators (was Re: C history question)

Tom Karzes karzes at mfci.UUCP
Tue Sep 19 05:49:25 AEST 1989


In article <1989Sep17.150504.16643 at jarvis.csri.toronto.edu> flaps at dgp.toronto.edu (Alan J Rosenthal) writes:
>A somewhat consistent but fairly bizarre syntax would be
>	x -=;
>
>The analogy to x -= y is that
>	x fn= y;
>expands to
>	x = fn(x, y);
>so
>	x fn=;
>expands to
>	x = fn(x);

The problem with this is that you would like it to have the same precedence
as ++ and --.  This causes the following:

    a -= * b

to be parsed as:

    (a -=) * b

rather than:

    a -= (* b)

which is the current correct parse (and which should remain the correct
parse).  You'd have to introduce a new operator to make this work reasonably.



More information about the Comp.lang.c mailing list