Article View: comp.std.c
Article #2938Re: pointer comparisons
From: Norman Diamond
Date: Thu, 31 Dec 1992 03:35
Date: Thu, 31 Dec 1992 03:35
16 lines
1312 bytes
1312 bytes
In article <1hsdg8INN5jm@urmel.informatik.rwth-aachen.de> berg@physik.tu-muenchen.de (Stephen R. van den Berg) writes:
>#include <stdlib.h>
>void*a,*b;
>main()
>{ int i;
> a=malloc(1); b=malloc(1);
> i+=a>b;
[Irrelevant portions of the code deleted to save space.]
The comparison operators are defined under some conditions, always including
that they point into the same object (and/or one element past an array object).
Your a and b point to different objects, so the behavior is undefined.
--
Norman Diamond diamond@jit.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
Pardon me? Or do I have to commit a crime first?
Technical Details
Message-ID:
<C03tzB.BvH@jrd.dec.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!deccrl!news.crl.dec.com!dbased.nuo.dec.com!e2big.mko.dec.com!jrdzzz.jrd.dec.com!jit533.jit.dec.com!diamondReferences:
<1hsdg8INN5jm@urmel.informatik.rwth-aachen.de>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!deccrl!news.crl.dec.com!dbased.nuo.dec.com!e2big.mko.dec.com!jrdzzz.jrd.dec.com!jit533.jit.dec.com!diamond From: diamond@jit533.jit.dec.com (Norman Diamond) Subject: Re: pointer comparisons Message-ID: <C03tzB.BvH@jrd.dec.com> Sender: usenet@jrd.dec.com (USENET News System) Nntp-Posting-Host: jit533.jit.dec.com Reply-To: diamond@jit.dec.com (Norman Diamond) Organization: Digital Equipment Corporation Japan , Tokyo References: <1hsdg8INN5jm@urmel.informatik.rwth-aachen.de> Date: Thu, 31 Dec 1992 03:35:35 GMT Lines: 16