From -3460147867801792703
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-12-08 11:55:14 PST
Newsgroups: comp.std.c++
Path: sparky!uunet!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: <1992Dec8.194810.13875@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: <1992Dec1.175548.16232@meaddata.com> <1992Dec03.200934.26919@microsoft.com> <ALANB.92Dec7104909@catalina.sdl.mdcbbs.com>
Date: Tue, 8 Dec 1992 19:48:10 GMT
Lines: 38

In article <ALANB.92Dec7104909@catalina.sdl.mdcbbs.com> alanb@sdl.mdcbbs.com (Alan Braggins) writes:
>>>>>> On 03 Dec 92 20:09:34 GMT, jimad@microsoft.com (Jim Adcock) said:
>
>> |  I don't think that requiring total ordering would break any existing
>> |program, but it would break quite a few existing compilers. 
>
>> You think wrong.  To quote from the ANSI-C rationale, existing implementations
>> don't matter -- existing CODE does.  MUCH existing code depends on partial
>> ordering.  And NOT just on PCs.
>
>Then why have no examples been shown?
>--

	Did you miss the example I posted? 

	int * far x= new int[20]; // assume each array in different segment
	int * far y= new int[20];
	int * near ye=y+20; // offset part only
	for(int * near xe=&x; xp<ye; ++xp) ...

Here the offsets only are used in the loop, so the termination test
checks if xp<ye even though x and Y are in different segments, it works,
and is much faster than comparing the full 48 bit addresses,
which would always satisfy xp<ye or xp>ye. Thus this conforming
but not strictly conforming code would go into an infinite loop
if total ordering were required.

(The 'near' keyword is of course compiler/system specific, so clearly
this code is not strictly conforming anyhow. All 80x86 systems
support these extensions because they're necessary, that doesnt make
the programs non-conforming, just not strictly conforming)


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


