[comp.lang.c] pointer equality

diamond@csl.sony.co.jp (Norman Diamond) (09/14/89)

In article <2079@munnari.oz.au> ok@cs.mu.oz.au (Richard O'Keefe) writes:

>People are encouraged to think of == as testing for EQUALITY.
>In dpANS C, [in the case of pointers] it appears that == does *NOT*
>have the properties of equality, and at the very least this needs to
>be said clearly and explicitly in the Rationale.

In fact, it calls for a note in the Standard, in the section defining
the == operator.  Surely no one can claim that this effect of the rule
is obvious, or that it yields the least surprising results.

--
-- 
Norman Diamond, Sony Corporation (diamond@ws.sony.junet)
  The above opinions are inherited by your machine's init process (pid 1),
  after being disowned and orphaned.  However, if you see this at Waterloo or
  Anterior, then their administrators must have approved of these opinions.

davidl@intelob.intel.com (David Levine) (09/19/89)

In article <10840@riks.csl.sony.co.jp> diamond@csl.sony.co.jp (Norman Diamond) writes:
> In article <2079@munnari.oz.au> ok@cs.mu.oz.au (Richard O'Keefe) writes:
> >People are encouraged to think of == as testing for EQUALITY.
> >In dpANS C, [in the case of pointers] it appears that == does *NOT*
> >have the properties of equality, and at the very least this needs to
> >be said clearly and explicitly in the Rationale.
>
> In fact, it calls for a note in the Standard, in the section defining
> the == operator.  Surely no one can claim that this effect of the rule
> is obvious, or that it yields the least surprising results.

I'm sorry, I must have missed something.  I was on vacation for two
weeks; perhaps the referenced article expired.  Now I've waited almost
a week for someone to follow this one up, but apparently nobody else
is, so:

Why do you claim that == doesn't test for equality on pointers?  The
dpANS tells us that two pointers are equal if they point to the same
object; isn't that the only possible portable definition of pointer
equality?  (I DON'T want a definition of pointer equality that
compares bit patterns.)

As I said, perhaps I've missed something.

            David D. Levine                BBBBBBBBB  IIII IIII NNN  NNNN TM
        Senior Technical Writer            BBBB  BBBB iiii iiii NNNN NNNN
                                           BBBBBBBBB  IIII IIII NNNNNNNNN
UUCP: ...[!uunet]!tektronix!biin!davidl    BBBB  BBBB IIII IIII NNNN NNNN
MX-Internet: <davidl@intelob.intel.com>    BBBBBBBBB  IIII IIII NNNN  NNN
ARPA: <@iwarp.intel.com:davidl@intelob.intel.com>