🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #12875

Re: Available no. of registers

#12875
From: guy
Date: Sat, 24 Jan 1987 21:42
28 lines
1349 bytes
>God forbid, but there is probably some C program out there that relies
>on being able to:
>	int a,b, *ptr;
>
>	ptr = &a;
>	ptr++;
>	/* ptr now points to b */

No program that relies on that is correct C, so no compiler is
obliged to make them work.  In fact, the sooner such programs *are*
prevented, the better off we'll all be.

If the person *really* wanted that, they should have done

	int array[2], *ptr;

	ptr = &array[0];
	ptr++;
	/* ptr now points to array[1] */

and, if for some mysterious reason they insist on referring to these
objects as "a" and "b", they could do

	#define	a	array[0]
	#define	b	array[1]

Nowhere does C guarantee that contiguously-declared objects will be
given contiguous addresses in memory.
Technical Details
Message-ID: <12055@sun.uucp>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!ames!oliveb!sun!gorodish!guy
References: <3810002@nucsrl.UUCP> <926@mips.UUCP> <759@vaxb.calgary.UUCP> <170@microsoft.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!ames!oliveb!sun!gorodish!guy
From: guy@gorodish.UUCP
Newsgroups: comp.arch
Subject: Re: Available no. of registers
Message-ID: <12055@sun.uucp>
Date: Sat, 24-Jan-87 16:42:07 EST
Article-I.D.: sun.12055
Posted: Sat Jan 24 16:42:07 1987
Date-Received: Sun, 25-Jan-87 00:15:58 EST
References: <3810002@nucsrl.UUCP> <926@mips.UUCP> <759@vaxb.calgary.UUCP> <170@microsoft.UUCP>
Sender: news@sun.uucp
Reply-To: guy@sun.UUCP (Guy Harris)
Organization: Sun Microsystems, Mountain View
Lines: 28