YAAO (yet another assignment operator)

sde at Mitre-Bedford sde at Mitre-Bedford
Fri Dec 28 10:22:42 AEST 1984


	>>
	>>I can see two purposes of this <binop>= operator:
	>>
	>>1.	More dense, compact or readable programs.
	>>
------>>2.Make more efficient programs when the compiler isn't smart enough
	>>	to see this himself.

	>>...
	>>In this case, I am more interested in point 2. Why not expand this
	>>to the more general case where
	>>	>>X = ... X ...;
	>>can be rewritten to an expression where the address of X only needs to
	>>be calculated once. The syntax for this could be
	>>	>>let X = expr in ... X ...;
	>>for example
	>>	>>let x = a[j*10+i] in x = func(x);
	>>This example shows a case where the compiler could not do this
	>>optimization if 'j' or 'i' was (sic) global variables(sic). Another
	>>syntactic form could be
	>>	>>X = expr @ ... X ...;
	>>This construction already exists in some languages.

I shudder to suggest this, but if you want that effect, how about:

register float *y;
...
*(y=&a[...]) = func( *y );

    David   sde at mitre-bedford



More information about the Comp.lang.c mailing list