Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!indri!nic.MR.NET!shamash!nis!quad!dts From: dts@quad.uucp (David T. Sandberg) Newsgroups: comp.lang.c Subject: Re: When it is amoral... (Re: When is a cast not a cast?) Message-ID: <127@quad.uucp> Date: 6 May 89 16:52:56 GMT References: <2765@buengc.BU.EDU> <563@lzaz.ATT.COM> <4093@ficc.uu.net> Reply-To: dts@quad.uucp (David T. Sandberg) Organization: Quadric Systems, Richfield MN Lines: 27 In article <4093@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes: >In article <563@lzaz.ATT.COM>, hutch@lzaz.ATT.COM (R.HUTCHISON) writes: >> midpoint_pointer = (start_pointer + end_pointer) / 2; > >You're right. It's a valid operation. It is? What about when the difference between the two is an odd number of multibyte units? Writing to *midpoint_pointer after setting it up in such a fashion is going to corrupt some data (unless, of course, you *want* to modify the last byte(s) of one unit and the first byte(s) of the next ;') >(what's the average of the 7 clubs and the 9 clubs?) More to the point, what's the difference between the 7 clubs and the 8 clubs? Perhaps you mean that it is an *allowed* operation, without regards to the wisdom of same. Or perhaps you guys are only talking about char pointers (and then what happens if you run into a multibyte char machine?). -- char *david_sandberg() { return ( dts@quad.uucp || uunet!rosevax!sialis!quad!dts ); }