if vs ?: - (nf)

saj at iuvax.UUCP saj at iuvax.UUCP
Thu Feb 16 06:12:22 AEST 1984


#N:iuvax:9500002:000:555
iuvax!apratt    Feb 15 00:44:00 1984

In reading through the Lattice C manual, I came across the note that the
compiler detects and discards statements like
	i+j;
which have no side effects. This brings to mind the fact that any expression
is a legal statement. With that in mind, can anybody tell me the likely
difference between
	if ( i )
		j++;
	else
		k++;

and

	i ? j++ : k++ ;

...?  Surely there will be differences in the compiled code.. Can somebody
tell me what they are likely to be?

----

	"Can YOU whistle at 300 baud?"
					-- Allan Pratt
			...decvax!ihnp4!inuxc!iuvax!apratt



More information about the Comp.lang.c mailing list