Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!apple.com!desnoyer From: desnoyer@apple.com (Peter Desnoyers) Newsgroups: comp.lang.c Subject: Re: Short code to determine compiler's register use Message-ID: <2811@internal.Apple.COM> Date: 13 Jul 89 17:29:49 GMT References: <396@uop.uop.EDU> Sender: usenet@Apple.COM Organization: Apple Computer, Inc. Lines: 26 In article <396@uop.uop.EDU> greg@uop.EDU (Greg Onufer) writes: > main(){{ /* block 1 */ > int count1; /* Base of stackframe */ > register x1, x2, ... { > int count2; > }} > { /* block 2 */ > int count1; > register *x1, *x2, ... { > int count2; /* Base of new stackframe */ ^^^^^^^^^^^^^^ > [...] (code has been brutalized to squeeze out lines) Remember that the compiler does not have to create a new stack frame when it encounters a block. It can just append the block variables to the auto variables for the function and add initialization code where needed. If it is smart it will know that auto variables in different blocks don't conflict and can use the same storage locations. Try printing out the addresses of each instance of count1 and count2 on different compilers. That might give you some additional insight into what is going on. Peter Desnoyers Apple ATG (408) 974-4469