Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Re^2: Another silly question Message-ID: <10160@smoke.BRL.MIL> Date: 29 Apr 89 02:08:54 GMT References: <2459@nmtsun.nmt.edu> <10135@smoke.BRL.MIL> <1266@l.cc.purdue.edu> <4625@freja.diku.dk> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 11 In article <4625@freja.diku.dk> njk@freja.diku.dk (Niels J|rgen Kruse) writes: -No. If you have pointers -long *p1,*p2,*p3,*p4; -with p1 <= p2 and p3 <= p4 and want to test (p2-p1) < (p4-p3), -you can write -if ((char *)p2 - (char *)p1 < (char *)p4 - (char *)p3) -which won't generate any shifting. That might generate shifting, depending on the implementation. What you should write is simply if ( p2 - p1 < p4 - p3 )