🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2943

Re: pointer comparisons

#2943
From: Stan Brown
Date: Thu, 31 Dec 1992 13:30
26 lines
1298 bytes
In article <1hsdg8INN5jm@urmel.informatik.rwth-aachen.de> berg@physik.tu-muenchen.de (Stephen R. van den Berg) writes:
>What about the following program:     [of which I show only the salient parts]
>void*a,*b;
>
>main()
>{ int i;  /* initial assignment deleted */
>  a=malloc(1); b=malloc(1);
>  i+=a>b; 
>  printf("%d\n",i);
>  return i;
>}
>---------------------------------------
>
>Is this program *always* required to print or return "3"?

I believe this program is not obligated to print or return _anything_,
but may, in John Woods's happy phrase, "cause demons to fly out of your
nose."

Comparing pointers that point to different objects leads to an undefined
result.  See ANSI section 3.3.8 (ISO 6.3.8, I believe).
-- 
Stan Brown, Oak Road Systems                      brown@Ncoast.ORG
Cleveland, Ohio, USA

What's a question that contains the word 'cantaloupe' for no apparent reason?
Technical Details
Message-ID: <C04LIz.3DG@NCoast.ORG>
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!gatech!usenet.ins.cwru.edu!ncoast!brown
References: <1hsdg8INN5jm@urmel.informatik.rwth-aachen.de>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!gatech!usenet.ins.cwru.edu!ncoast!brown
From: brown@NCoast.ORG (Stan Brown)
Subject: Re: pointer comparisons
Organization: Oak Road Systems, Cleveland Ohio USA
Date: Thu, 31 Dec 1992 13:30:35 GMT
Message-ID: <C04LIz.3DG@NCoast.ORG>
References: <1hsdg8INN5jm@urmel.informatik.rwth-aachen.de>
Lines: 26