if vs ?: - (nf)

usenet usenet at abnjh.UUCP
Sat Feb 18 01:29:22 AEST 1984


The system V pcc compiler for the 3B20S generates two more
instructions for

	"i ? j++ : k++ ;"

than it does for 

	"if (i) j++ else k++;"

In the former case, it is apparently attempting to get the
value of the result of the expression (namely the prior value
of j or k, depending on the value of i) into a register.
Even though it never uses the value in the register for anything!

It does this regardless of the setting of the "-O" (optimize) flag.
The only effect of the -O flag is to replace jumps to returns by
returns.

Rick Thomas
ihnp4!abnji!rbt   or   ihnp4!abnjh!usenet



More information about the Comp.lang.c mailing list