Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!fluke!ssc-vax!lee From: lee@ssc-vax.UUCP (Lee Carver) Newsgroups: comp.lang.c Subject: Re: C IF statement efficiency... Summary: muddying the waters Message-ID: <1131@ssc-bee.ssc-vax.UUCP> Date: 18 Aug 88 17:43:42 GMT References: <8808171400.AA05122@ucbvax.Berkeley.EDU> Organization: Boeing Aerospace Corp., Seattle WA Lines: 18 In article <8808171400.AA05122@ucbvax.Berkeley.EDU>, U23405@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; | | In other words, does a compiler handle IF statements with RETURNs more or less | efficiently than IF..ELSE statements with RETURNs (or with other statements | besides RETURN, for that matter) ? Just to muddy the waters, for this application you can use return ( big > small ? big : small ) But, maybe you have a real body of code to execute?