YAAO (yet another assignment operator)

andrew at orca.UUCP andrew at orca.UUCP
Fri Dec 28 10:23:03 AEST 1984


[]

	"The idea of <binop>= strikes me as a very good and very easy
	to implement idea.  Consider that
		X <binop>= Y;		(call this form 1)
	is exactly the same statement as
		X = X <binop> Y;	(call this form 2)

	"Given that <binop> is a legal operator, all C compilers
	already have code to compile form 2.  All we have to do now is
	modify the compiler(s) to convert form 1 to form 2.  This
	should be utterly trivial, and allows us to add a nice bit of
	generality to C."

This isn't really true.  For example, the following two statements have
different meanings:

		X[6*rand()] *= Y;
		X[6*rand()] = X[6*rand()] * Y;

A programmer who codes the first form would not be satisfied if the
compiler were to produce the second form.

  -- Andrew Klossner   (decvax!tektronix!orca!andrew)       [UUCP]
                       (orca!andrew.tektronix at csnet-relay)  [ARPA]



More information about the Comp.lang.c mailing list