Path: utzoo!attcan!uunet!lll-winken!lll-lcc!unisoft!mtxinu!sybase!bosco!ben From: ben@bosco.UUCP (ben ullrich) Newsgroups: comp.lang.c Subject: Re: C IF statement efficiency... Summary: c if statements Keywords: c if Message-ID: <566@sybase.sybase.com> Date: 19 Aug 88 19:41:01 GMT References: <8808171400.AA05122@ucbvax.Berkeley.EDU> Sender: news@sybase.sybase.com Reply-To: sybase!ben@sun.com (ben ullrich) Distribution: na Organization: sybase, inc., emeryville, ca Lines: 22 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; > how about return ((big > small) ? big : small) i don't know how efficient this is, but it is certainly more succinct than those suggested in the quoted text above. ...ben -- ben ullrich sybase, inc. database administrator 6475 christie avenue mis department emeryville, ca 94608 {pyramid,pacbell,sun,mtxinu,capmkt}!sybase!ben 415 - 596 - 3654