YAAO (yet another assignment operator)

Benjamin Thompson bjpt at mulga.OZ
Sun Dec 30 04:16:22 AEST 1984


In article <6771 at brl-tgr.ARPA> gwyn at brl-tgr.ARPA (Doug Gwyn <gwyn>) writes:
>> 		X <binop>= Y;		(call this form 1)
>> is exactly the same statement as
>> 		X = X <binop> Y;	(call this form 2)
>
>Not quite.  Another part of the semantics is that "X" is evaluated
>ONLY ONCE.  So a naive translation of form 1 to form 2 won't work.

Quite - I forgot about nifty little lvalues like *++x.  Even so, I should
imagine there is already code in the compilers to handle this type of problem
for the <binop>= operators C already has.  I think altering a C compiler to
allow more general <binop>='s should still be fairly trivial.
operators we already have 



More information about the Comp.lang.c mailing list