From 4982353561415879876
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-12-15 15:03:24 PST
Path: sparky!uunet!mcsun!sunic!hagbard!loglule!jbn
From: jbn@lulea.trab.se (Johan Bengtsson)
Newsgroups: comp.std.c++
Subject: Re: Zero-length structures and pointer comparisons
Message-ID: <5385@holden.lulea.trab.se>
Date: 15 Dec 92 19:06:22 GMT
References: <1992Dec14.230730.24452@microsoft.com>
Organization: Telia Research AB, Aurorum 6, 951 75 Lulea, Sweden
Lines: 36
X-Newsreader: TIN [version 1.1 + PL8]

Jim Adcock (jimad@microsoft.com) wrote:
: In article <5366@miramon.lulea.trab.se> jbn@lulea.trab.se (Johan Bengtsson) writes:
: |Other OODBMSs that use straight pointers to refer to persistent
: |objects (e.g. ObjectStore,Texas) must provide a rather special
: |ptrcmp(void*,void*), or disallow use of ptrcmp() for persistent
: |objects (may be difficult to check).

: What if ptrcmp [addrcmp] were allowed to return 0 for those objects
: and/or systems that don't define an ordering for those objects?

The problem is not to be able to order persistent objects, once
you know that you have a void* refering to one.  Also, I wouldn't
expect the comparison on persistent object IDs to be too slow to use,
since we are talking about objects that anyway needs to be transferred
to and from slow disks.

The real problem is distinguishing between void* to memory objects and
void* to persistent objects.

: The implication would be that one routine could be written that uses
: a fast ordering scheme on those OS's and/or objects that support the 
: ordering, but a slower secondary scheme would have to be included for
: those cases of objects or OS's where the order is undefined. 
: The secondary scheme would only have to be implemented by those programmers
: *really* interested in writing *really* portable code, since a defined
: ordering out of ptrcmp would be a common extension.

I think systems that can't completely support ptrcmp() should simply
refrain from defining it.  That will make the problem evident at an early
stage (link time).

-- 
--------------------------------------------------------------------------
| Johan Bengtsson, Telia Research AB, Aurorum 6, S-951 75 Lulea, Sweden  |
| Johan.Bengtsson@lulea.trab.se; Voice:(+46)92075471; Fax:(+46)92075490  |
--------------------------------------------------------------------------


