Article View: comp.arch
Article #12864Re: Available no. of registers
From: Tim Olson
Date: Fri, 23 Jan 1987 02:37
Date: Fri, 23 Jan 1987 02:37
33 lines
1777 bytes
1777 bytes
In article <1029@cuuxb.UUCP>, mwm@cuuxb.UUCP (Marc W. Mengel) writes:
+---------------------------------------
| Unfortunately, you don't have to take the address of a given variable
| to use it, you merely have to take the address of a variable near it
| and add an offset to it. The way C is defined, this is quite legal.
|
| For example, suppose I have a function f, declared as follows:
| f(p)
| struct { int a, b, c; } *p;
| {
| ...
| }
| And I call it as follows:
| b()
| {
| int a, b, c;
|
| f( &a );
| }
| According to our venerable friends kerningham&ritchie, this is legal;
| it is also used to some great extent in the older (v6 & v7) unix kernels.
+---------------------------------------
What is legal is not necessarily correct. The above will not run on Vaxen
with pcc (or, for that matter, any machine/compiler combination where stacks
grow in a direction opposite that of global variables). Anyone who uses
such a construct should be put out of our misery.
[ By the way, I first thought that this wouldn't work on any machine I knew
of, but it *actually works* on an IBM RT-PC! Really! ]
-- Tim Olson
Advanced Micro Devices
Technical Details
Message-ID:
<14444@amdcad.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-lcc!pyramid!amdahl!amdcad!timReferences:
<3810002@nucsrl.UUCP> <926@mips.UUCP> <759@vaxb.calgary.UUCP> <1029@cuuxb.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!mnetor!seismo!lll-lcc!pyramid!amdahl!amdcad!tim From: tim@amdcad.UUCP (Tim Olson) Newsgroups: comp.arch Subject: Re: Available no. of registers Message-ID: <14444@amdcad.UUCP> Date: Thu, 22-Jan-87 21:37:18 EST Article-I.D.: amdcad.14444 Posted: Thu Jan 22 21:37:18 1987 Date-Received: Fri, 23-Jan-87 21:22:41 EST References: <3810002@nucsrl.UUCP> <926@mips.UUCP> <759@vaxb.calgary.UUCP> <1029@cuuxb.UUCP> Organization: AMDCAD, Sunnyvale, CA Lines: 33 Summary: legal is not necessarily correct...