Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!texbell!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: Pointer arithmetic and comparisons. Message-ID: <7302@ficc.uu.net> Date: 14 Dec 89 14:25:24 GMT References: <257ECDFD.CDD@marob.masa.com> <232@bohra.cpg.oz> <2908@murtoa.cs.mu.oz.au> <2241@dataio.Data-IO.COM> Reply-To: peter@ficc.uu.net (Peter da Silva) Organization: Xenix Support, FICC Lines: 14 > bright@dataio.Data-IO.COM (Walter Bright) writes: > (p <= pend) generates more efficient code (on PC's) than (p == pend), because > on the former only the offset portions of the pointer need to be compared, > while on the latter both the segment and the offset must be compared. Implementation-dependent micro-optimisation isn't a good reason. A good one is that !p <= pend! is a broader termination condition, and thus safer. -- `-_-' Peter da Silva. +1 713 274 5180. . 'U` Also or . "Scientific progress is predicated on name-calling and intolerance, not to mention asking lots of stupid questions." -- Mark S Madsen