From 4568312111765948164
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-12-21 10:47:37 PST
Newsgroups: comp.std.c++
Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Subject: Re: Zero-length structures and pointer comparisons
Message-ID: <9235623.26595@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU
Organization: Computer Science, University of Melbourne, Australia
References: <1992Dec8.173855.18153@meaddata.com> <1992Dec10.121935.19315@ucc.su.OZ.AU> <KANZE.92Dec10171114@slsvdnt.us-es.sel.de> <1992Dec20.012551.11306@ucc.su.OZ.AU>
Date: Mon, 21 Dec 1992 12:15:39 GMT
Lines: 39

maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:

>kanze@us-es.sel.de (James Kanze) writes:
>>As it should.  The ARM (and the upcoming ANSI standard) can only
>>address what happens in the context of C++, not what happens to the
>>pointer once the OS gets its hands on it.
>
>	No, this is not true IMHO. The ARM can and does explicitly
>or implicitly say "implementation defined" where it means that.
>When the ARM says "so and so will be the case" then it must
>always be the case.

No. The ARM described a contract between implementations and programmers,
such that IF the programmer abides by certain restrictions, then
the program will produce certain behaviour. If the programmer does
not abide by these restrictions, then the ARM does not guarantee anything
about the behaviour of the program.

>>In the same way, I would understand the ARM to be saying that all
>>pointers generated by a correct program to point to any object defined
>>(including a dynamic definition by new) in C++ will compare equal.  If
>>you give the pointer to the OS, and it gives it back to you, then any
>>guarantees must be made by the OS, and not the C++ language.
>
>	I agree. But that is not the case. The ARM says different.
>It absolutely requires pointers to the same object to compare
>equal, without qualification. The system MUST ensure this
>to classify as conforming.

This statement is NOT without qualification. Virtually the whole of the
ARM is qualified by the caveat that if the program invokes undefined
behaviour, then all bets are off. Since the ARM is a reference manual,
not a standard, this caveat is implicit rather than explicit.

-- 
Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
This .signature virus is a self-referential statement that is true - but 
you will only be able to consistently believe it if you copy it to your own
.signature file!


