Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!lll-winken!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!roemer From: roemer@cs.vu.nl (Roemer Lievaart) Newsgroups: comp.lang.c Subject: Re: Addition of pointers Message-ID: <2459@solo12.cs.vu.nl> Date: 8 May 89 17:03:29 GMT References: <2765@buengc.BU.EDU> <563@lzaz.ATT.COM> <4093@ficc.uu.net> <2299@mit-caf.MIT.EDU> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 20 vlcek@mit-caf.MIT.EDU (Jim Vlcek) writes: >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 not. It is a wrong way to write: midpoint_pointer = start_pointer + (end_pointer - start_pointer) / 2; >In what sense? It's invalid C, that's for sure. It's invalid anyway: addition of pointers is in general nonsense. It may make sense to take the average of two pointers, but not by defining it in ways of two senseless operations (on pointers): addition and division. ____________________________________________________________________________ Roemer B. Lievaart | "Wa:a:na:a: das Soogo! Schnell!" "GRONF!" "Ich krich die Amsterdam, Holland | Packung nicht auf!" "Gargll" "Da:s woo ho:o:ste Oisnbohn, roemer@cs.vu.nl | Das woissu ja wohl!" -- Bro:sel, "Werner, Normal Ja!"