Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!brl-adm!rutgers!princeton!allegra!mit-eddie!genrad!decvax!tektronix!uw-beaver!microsoft!johnt From: johnt@microsoft.UUCP Newsgroups: comp.arch Subject: Re: Available no. of registers Message-ID: <170@microsoft.UUCP> Date: Thu, 22-Jan-87 12:28:54 EST Article-I.D.: microsof.170 Posted: Thu Jan 22 12:28:54 1987 Date-Received: Sat, 24-Jan-87 09:46:17 EST References: <3810002@nucsrl.UUCP> <926@mips.UUCP> <759@vaxb.calgary.UUCP> Organization: Microsoft, Inc., Redmond, Washington Lines: 30 Summary: inner scopes and registers > Shouldn't a compiler smart enough to allocate variables to registers be > smart enough to see that a local variable is never the operand of the > & (address-of) operator, and thus cannot be referenced by a pointer? 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 flames please, if there is such a program out there, >I< didn't write it. > . . . Unfortunately if you use inner scopes this isn't always possible. > E.g. > > proc() > { register int blat, blog, blit; > ... > { register int glip, glop, glurp; > ... > } > } I once used a 68000 compiler that would indeed ignore 'register' for inner scope variables. I ended up moving all the variable declarations to the head of the procedure. ----- John Tupper ...!decvax!microsoft!johnt