🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #802

Re: Two questions about pointers

#802
From: T. William Wells
Date: Sat, 21 Oct 1989 00:51
28 lines
1573 bytes
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.

: (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.

: Note that Section 3.3.9 does not answer Question (1), at least not directly.
: It gives the implication around the other way (equal pointers must point to
: the same object).  Question (2) is of particular interest if the second
: type is void*.

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."

---
Bill                    { uunet | novavax | ankh | sunvice } !twwells!bill
bill@twwells.com
Technical Details
Message-ID: <1989Oct21.005145.23598@twwells.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!twwells!bill
References: <1989Oct18.121516.10695@anucsd.oz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!twwells!bill
From: bill@twwells.com (T. William Wells)
Newsgroups: comp.std.c
Subject: Re: Two questions about pointers
Message-ID: <1989Oct21.005145.23598@twwells.com>
Date: 21 Oct 89 00:51:45 GMT
References: <1989Oct18.121516.10695@anucsd.oz>
Organization: None, Ft. Lauderdale, FL
Lines: 28