From -458153549922551695
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,edb7b260f2974eab
X-Google-Attributes: gidf78e5,public
From: Tom Payne <thp@cs.ucr.edu>
Subject: Re: C/C++ object identity (was: C++ briar patch (Was: Object IDs are bad))
Date: 1997/05/28
Message-ID: <5midmt$4t9@skylark.ucr.edu>#1/1
X-Deja-AN: 244650947
References: <5l27qb$2fm$1@Masala.CC.UH.EDU> <EA2oyH.J21@research.att.com> <5lbffe$dhb$1@goanna.cs.rmit.edu.au> <5lotr8$e7n@mulga.cs.mu.OZ.AU> <xohn2pr14zi.fsf@ai.emba.uvm.edu> <5lrc40$5e0@mulga.cs.mu.OZ.AU> <3383ED66.5622@strip_these_words.ix.netcom.com> <5m1upg$olo@mulga.cs.mu.OZ.AU>
X-Original-Date: 28 May 1997 23:05:01 GMT
Organization: Dept. Computer Science, UCR
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBM40TCEy4NqrwXLNJAQH/KQIAicps40NKzi7pmFPvREO6k44U/5a6vt8W HDFwAcY3WbCeS32tyg+HEJZ4TgoUKk5DBh2TUvItd9hBNmizYt4jvw== =nGgI
Newsgroups: comp.std.c++
Originator: austern@isolde.mti.sgi.com


In comp.std.c++ Fergus Henderson <fjh@mundook.cs.mu.OZ.AU> wrote:
[...]
: When I said "If `==' was really intended to be undefined ...",
: I meant "If the C standard committee had really intended to make
: the results of `==' undefined ...".
[...]
: Hyopthetically assuming that the C standard committee had really
: intended to make the results of `==' on ponters to unrelated objects
: undefined, 

I used to subscribe to that hypothesis, but 6.3.9 (Equality operators)
states:

   "Contraints

        One of the following shall hold:

   ---  ... ;

   ---  both operands are pointers to qualified or unqualified 
        versions of compatible types;

   ---  ... ; or

   ---  ... ."

In particular, it makes no restriction that the referrents of these
pointers be related.  Granted, 6.3.9 goes on to say:

   Where the operands have types and values suitable for the
   relational operators, the semantics detailed in 6.3.8 apply.

But unrelated objects apparently are not "suitable for the relational
operator" ( <, >, <= and >= ), since, according to 6.3.8:

   If the objects pointed to are not members of the same aggregate 
   or union object, the result is undefined. ...

I thought that the above 6.3.8 clause applied to equality operators,
since 6.3.8 goes on to discusses conditions under which pointers
"compare equal".  A more careful reading indicates that it applies
only to the relational operators, which seem to have a strictly
smaller domain than the equality operators.

Tom Payne
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



