From 8370900328614271879
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-12-17 08:18:18 PST
Newsgroups: comp.std.c++
Path: sparky!uunet!titan!lpi!pkt
From: pkt@lpi.liant.com (Scott Turner)
Subject: Re: Zero-length structures and pointer comparisons
Message-ID: <1992Dec17.150914.2783@lpi.liant.com>
Sender: pkt@lpi (Scott Turner)
Organization: Liant Software Corporation
References: <1992Dec11.230534.10499@microsoft.com> <1992Dec15.162202.11231@ucc.su.OZ.AU>
Date: Thu, 17 Dec 1992 15:09:14 GMT
Lines: 34

In article <1992Dec15.162202.11231@ucc.su.OZ.AU> John (Max) Skaller writes:
> In article <1992Dec11.230534.10499@microsoft.com> Jim Adcock writes:
> >No more nor less than any other virtual memory OS that allows
> >multiply mapped pages.  Since there is no functionality in the
> >language requiring such multiply mapped pages, you only get in
> >this situation by invoking some system dependency, in which case
> >you are making use of implementation dependencies.

> But Jim, it is not implementation defined, it is required that 
> pointers to the same object compare equal.

> It is therefore not
> allowed to do this sort of memory mapping in C++ behind the scenes,
> which is what I'm concerned with...we actually want to.

It makes me uneasy, but I think Jim Adcock is correct: an implementation
can define an extension, such as memory mapping, which overrides the usual
execution time rules of C/C++, including the rule that pointers to the same
object compare equal.  The rule that 1+1==2 would likewise be subject to
"extension".

Nevertheless, the C standard implies that the onus is on the invoker of memory 
mapping to be aware of libraries and other code which may rely on the usual
execution time rules of C/C++, such as the rule that pointers to the same
object compare equal.  If we don't want libraries to make that assumption,
then John (Max) Skaller is also correct to say

> So the question is really whether the requirement that pointers to
> the same object compare equal should be left implementation defined.
--
Prescott K. Turner, Jr.
Liant Software Corp. (developers of LPI languages)
959 Concord St., Framingham, MA 01701 USA    (508) 872-8700
UUCP: uunet!lpi!pkt                          Internet: pkt@lpi.liant.com


