From 4815624957137335089
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-10-28 05:24:40 PST
Newsgroups: comp.std.c++
Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Zero-length structures and pointer comparisons
Message-ID: <1992Oct28.184135.25475@ucc.su.OZ.AU>
Sender: news@ucc.su.OZ.AU
Nntp-Posting-Host: extro.ucc.su.oz.au
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
References: <1992Oct19.055511.18826@jyu.fi> <1992Oct21.153904.13965@ucc.su.OZ.AU> <1992Oct26.170404.1904@microsoft.com>
Date: Wed, 28 Oct 1992 18:41:35 GMT
Lines: 34

In article <1992Oct26.170404.1904@microsoft.com> jimad@microsoft.com (Jim Adcock) writes:
>Please note however, that if C++ diverged from C in requiring a total
>ordering, such a change would break many good, legal, conforming C/C++
>programs, because it is currently NOT *illegal* in C to make use of the C and 
>C++ definition of partial ordering -- such usages are merely *implementation 
>defined*.  Thus a switch at this late date to total ordering would
>represent a very large gratuitous change breaking many existing 
>conforming programs.

	I dont understand. For a start, there is NO requirement
that I can see that < is a partial order. Have I missed something?

	As I understand it the rules are:

	1) pointers to the same object compare ==
	2) within an array, < is a total order
	3) In other cases < is implementation defined.

In particular, in case 3 a compiler could just return TRUE for
all comparisons, so we do not have a partial order here.

Any program relying on some implementation defined order (3) cannot
be portable. If a total ordering was required, programs utilising
this requirement would be portable. Existing non-portable programs
might even suddenly become portable. Surely very few implementation
defined orderings would not be total orders anyhow, so very few
existing programs would be broken if the rules changed?


-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------


