🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #12916

Re: Aliasing, etc. in C

#12916
From: Chris Torek
Date: Wed, 28 Jan 1987 15:15
29 lines
1594 bytes
Guy hardly needs defending, but it may sound better coming from two
people:

	/* this code is not portable */
	int a,b, *ptr;

	ptr = &a;
	ptr++;
	/* ptr now points to b */

>[ From sun!gorodish!guy ]
>>No program that relies on that is correct C, so no compiler is
>>obliged to make them work.

In article <7803@decwrl.DEC.COM> brandenberg@star.dec.com
(bleakness...desolation...plastic forks...) writes:
>Oh?  If this is aberrant coding, you might want to look at your
>varargs.h file whose operation relies on these assumptions; and this is
>in the ANSI proposal.

Wrong.  *Varargs* is in the ANSI proposal.  Neither the *Vax*
*implementation* nor the *Sun* *implementation* (each of which
works by peeking at stack addresses) is the ANSI proposal.  Nor is
Pyramid's implementation, which is considerably more complex and
does *not* rely upon `ptr = &a; ptr++;' pointing to `b' (which is
only sometimes the case).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris@mimsy.umd.edu
Technical Details
Message-ID: <5230@mimsy.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mimsy!chris
References: <7803@decwrl.DEC.COM>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mimsy!chris
From: chris@mimsy.UUCP (Chris Torek)
Newsgroups: comp.arch
Subject: Re: Aliasing, etc. in C
Message-ID: <5230@mimsy.UUCP>
Date: Wed, 28-Jan-87 10:15:41 EST
Article-I.D.: mimsy.5230
Posted: Wed Jan 28 10:15:41 1987
Date-Received: Sun, 1-Feb-87 02:49:41 EST
References: <7803@decwrl.DEC.COM>
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 29
Summary: Guy is right (as usual)