C IF statement efficiency...

Michael T Sullivan sullivan at vsi.UUCP
Fri Aug 19 01:17:54 AEST 1988


In article <8808171400.AA05122 at ucbvax.Berkeley.EDU>, U23405 at UICVM writes:
> I was wondering if, of the two following program fragments, which one would
> be compiled more efficiently by most C compilers:
> 
>           if (big > small)             if (big > small)
>                return big;                  return big;
>           else                         return small;
>                return small;

Let's throw

	return (big > small ? big : small);

into the consideration pile as well.

-- 
Michael Sullivan				{uunet|attmail}!vsi!sullivan
V-Systems, Inc. Santa Ana, CA			sullivan at vsi.com
"Your mother was a hamster and your father smelled of eldeberries!  Pbbbt!"



More information about the Comp.lang.c mailing list