🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1306

Re: Zero-length structures and pointer comparisons

#1306
From: Daniel R. Edelson
Date: Fri, 18 Dec 1992 20:17
46 lines
2358 bytes
In article <1992Dec18.193554.18588@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
>In article <1992Dec16.201044.2968@microsoft.com> jimad@microsoft.com (Jim Adcock) writes:

>	I know what you are saying but dont see it.
>ARM p74:"two pointers to the same object compare equal".
>Any program for which this is not true cannot be conforming,
>neither strictly nor non-strictly, it is non-conforming, it is
>not in fact a C++ program.

I think this is a requirement on implementations, rather than
a requirement on programs. 

>	Or have I got this wrong?

You might have it backwards.

>	For this reason I think the ARM requirement is unworkable,
>and must be modified. The rule should state that pointers
>derived from the same object directly in the program must
>compare equal. Pointers obtained from the OS need not follow
>this rule, in that case it is implementation defined.

Neither the C standard nor the C++ standard discusses any OS.
(As far as I recall.)

A call to the operating system should be viewed as
a call to an extension supplied by the language provider. 
A program that uses an extension can be conforming but
not strictly conforming, as per the X3J16 definitions. 

Thus, I think a better rule is:
	``In a strictly conforming program, two pointers
	to the same object compare equal.''
Thus, this property need not be true in any program that
calls the operating system.

I think actually that ramifications of multiple inheritance 
and multiple object-addresses should be explicitly addressed
in the rule, such as by saying that a pointer to a base-class
subobject is not a pointer to the same object as a pointer
to the most-derived class object.

>        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au

Daniel Edelson
daniel@cse.ucsc.edu
Technical Details
Message-ID: <1gtblgINN72@darkstar.UCSC.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!olivea!hal.com!darkstar.UCSC.EDU!daniel
References: <1992Dec15.162202.11231@ucc.su.OZ.AU> <1992Dec16.201044.2968@microsoft.com> <1992Dec18.193554.18588@ucc.su.OZ.AU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!olivea!hal.com!darkstar.UCSC.EDU!daniel
From: daniel@cse.ucsc.edu (Daniel R. Edelson)
Newsgroups: comp.std.c++
Subject: Re: Zero-length structures and pointer comparisons
Message-ID: <1gtblgINN72@darkstar.UCSC.EDU>
Date: 18 Dec 92 20:17:52 GMT
References: <1992Dec15.162202.11231@ucc.su.OZ.AU> <1992Dec16.201044.2968@microsoft.com> <1992Dec18.193554.18588@ucc.su.OZ.AU>
Organization: University of California, Santa Cruz (CE/CIS Boards)
Lines: 46
NNTP-Posting-Host: oak.ucsc.edu