home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c++
- Path: sparky!uunet!utcsri!torn!nott!bnrgate!bcrka451!bcrki65!sjm
- From: sjm@bcrki65.bnr.ca (Stuart MacMartin)
- Subject: Re: Zero-length structures and pointer comparisons
- Message-ID: <1992Dec16.202711.22367@bcrka451.bnr.ca>
- Sender: 5E00 Corkstown News Server
- Organization: Bell-Northern Research Ltd., Ottawa, Canada
- References: <1992Dec9.133956.29659@lth.se> <1992Dec9.191606.5665@lucid.com> <BzCG7K.2sG@frumious.uucp>
- Date: Wed, 16 Dec 1992 20:27:11 GMT
- Lines: 40
-
- In article <BzCG7K.2sG@frumious.uucp> pat@frumious.uucp (Patrick Smith) writes:
- >
- >jss@lucid.com (Jerry Schwarz) writes:
- >|And
- >|
- >| if p < q is defined, ptrcmp(p,q) < 0 <=> p < q
- >
- >
- >This strikes me as nice to have, but not essential.
- >
- >On the other hand, this might be fairly cheap, given that
- >we're already insisting on
- >
- > p == q => ptrcmp(p,q) == 0
- >
-
- It makes me nervous to disagree with you, but haven't we already
- hammered to death the concept that p < q might be defined (but
- not generate a total ordering) if some ps and qs are not in the
- same segment? Or do the PC compilers only permit p < q for ps
- and qs in the same array?
-
- Suppose we have a compiler that uses segment offset to determine
- if p < q but memory address to determine if p == q.
-
- If p1 < q1 are near the end of segment 1,
- p2 < q2 are near the beginning of segment 2
- and q1 == p2 (because they refer to the same memory location),
-
- then
-
- p2 < q2 < p1 < q1 (because the segment is being ignored)
- but
- p2 == q1 and p2 != q2.
-
- Stuart
- --
- : Stuart MacMartin email: sjm@bnr.ca :
- : Bell-Northern Research phone: (613) 763-5625 :
- : PO Box 3511, Stn C, Ottawa, K1Y-4H7, CANADA Standard disclaimers apply. :
-