if vs ?: - (nf)

Mark Brukhartz mark at laidbak.UUCP
Tue Feb 21 09:42:58 AEST 1984


Some machine-dependent code uses "discarded values" for parameters
to asm() (assembly language) escapes. For example:

	a + b;					/* Assume result goes to r0 */
	asm("	(something using r0)	");	/* Do something funny with r0 */

The "a + b" could just as easily be "a < b ? a++ : b++". Such code
assumes that the compiler and optimizer will not ignore the "unneeded"
statement or value.

Quite a bit of recent Berkeley code uses asm() escapes to generate fast
VAX code. I don't like this any more than you do, but it's something to
keep in mind when considering a change to the compiler.

					Mark Brukhartz
				{allegra,ihnp4,ittral,trsvax}!laidbak!mark



More information about the Comp.lang.c mailing list