Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!eru!hagbard!sunic!news.funet.fi!hydra!cc.helsinki.fi!wirzenius From: wirzenius@cc.helsinki.fi (Lars Wirzenius) Newsgroups: comp.lang.c Subject: Re: Efficiency Question (really: nitpicking) Message-ID: <1991Feb27.011613.5177@cc.helsinki.fi> Date: 27 Feb 91 01:16:13 GMT References: <4bmBqau00Uh_M0aHgb@andrew.cmu.edu> Organization: University of Helsinki Lines: 23 I won't answer your question, since that has already been answered by more knowledgeable people than I, but I just wanted to point out two mistakes in your examples (at least one of which is a typo, I'm sure, but nevertheless): In article <4bmBqau00Uh_M0aHgb@andrew.cmu.edu>, rg2c+@andrew.cmu.edu (Robert Nelson Gasch) writes: [code edited for brevity] > if (x > y) z = x; > else x = y; > The same thing can be expressed like this: > z = (x > y) ? x : y; ..assuming you really meant "else z = y;" in the first version. > x++; > while (array[x] < max) do_this (); > which can be written as: > while (array[++x] < max) do_this (); This is not true, since the first version of the loop doesn't increment i at all. -- Lars "Nitpicking is fun" Wirzenius wirzenius@cc.helsinki.fi