Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!saxony!dgil From: dgil@pa.reuter.COM (Dave Gillett) Newsgroups: comp.lang.c Subject: Re: using ! Message-ID: <639@saxony.pa.reuter.COM> Date: 28 Dec 90 02:50:24 GMT References: <009417DC.37A9DCA0@cemmva.cem.msu.edu> <544@taumet.com> Distribution: na Organization: Reuter:file Inc (A Reuter Company) Palo Alto, CA Lines: 21 In <544@taumet.com> steve@taumet.com (Stephen Clamage) writes: >heroux@cemmva.cem.msu.edu (Brett Heroux) writes: >>Is !(a > b) portable? >>slower or faster than a <= b? >Depends on the compiler and machine. Many compilers will generate >identical code for both constructs. You can look at the code your >compiler generates for each construct, and if they are different, >measure the time taken by each version. If you choose one construct >on this basis, you must realize that the next compiler or machine you >use may not produce the same result. If you find a compiler that generates different code for the two cases, it is most likely to have crudely generated code for the !(a > b) case, where two different operators appear, rather than for the single operator in the a <= b case. So while a good compiler will generate the same code for both cases, a bad compiler is likely to generate better code for the a <= b case. Dave