Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!uunet!munnari.oz.au!csc!bdm659 From: bdm659@csc.anu.oz Newsgroups: comp.std.c Subject: Re: Two questions about pointers Message-ID: <849.2542f059@csc.anu.oz> Date: 23 Oct 89 11:04:56 GMT References: <1989Oct18.121516.10695@anucsd.oz> <1989Oct21.005145.23598@twwells.com> Organization: Computer Services, Australian National University Lines: 31 In article <1989Oct21.005145.23598@twwells.com>, bill@twwells.com (T. William Wells) writes: > In article <1989Oct18.121516.10695@anucsd.oz> bdm@anucsd.oz (Brendan McKay) writes: > : (1) Is it true that two pointers of the same type which point to the > : same object must compare equal? > > Yes. See 3.3.9. Read further before disagreeing. > You either have an old draft or you have not read yours carefully. > From the May 88 draft: "If two pointers point to the same object > or function, they compare equal." Yes, alas, I have an old draft. This addition places the semantics of pointers on MUCH firmer footing. Pointers to objects, anyway. [Can someone please mail me the address for ordering the most recent draft? And the price. Thanks muchly.] > : (2) If two pointers of the same type compare equal, and each is cast > : to a second pointer type, must the results compare equal? > > If there is an object there of that new type, yes. (E.g., unions.) > Or, if both pointers were originally of the new type, yes. > As near as I can tell, converting two pointers to a void* and then > testing for equality does not have to work, unless both were > void*'s to begin with. Yes, that certainly follows from the sentence my copy doesn't have. Thanks. As far as I can tell, my (old) draft contains absolutely nothing about the meaning of the equality operators (==, !=) when applied to void* values. Has that situation changed, or do we still have to guess? Brendan McKay. bdm@anucsd.oz or bdm@anucsd.oz.au