Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!sri-unix!hplabs!decwrl!pyramid!prls!philabs!mcnc!rti-sel!dg_rtp!meissner From: meissner@dg_rtp.UUCP Newsgroups: comp.arch Subject: Re: Available no. of registers Message-ID: <884@dg_rtp.UUCP> Date: Fri, 23-Jan-87 11:29:06 EST Article-I.D.: dg_rtp.884 Posted: Fri Jan 23 11:29:06 1987 Date-Received: Wed, 28-Jan-87 06:20:34 EST References: <3810002@nucsrl.UUCP> <926@mips.UUCP> <759@vaxb.calgary.UUCP> <1029@cuuxb.UUCP> Reply-To: meissner@dg_rtp.UUCP (Michael Meissner) Organization: Data General (Languages @ Research Triangle Park, NC.) Lines: 31 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. And this poor coding method will produce obscure results when used on compilers that try to optimize the variables (group small items near the beginning of the stack frame so instructions with small displacements can be used, or to try and group frequently used items together). Even if the compiler doesn't reorganize things, it plays havoc if the stack goes in the oppisite direction. -- Michael Meissner, Data General ...mcnc!rti-sel!dg_rtp!meissner