Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!ames!oliveb!sun!gorodish!guy From: guy@gorodish.UUCP Newsgroups: comp.lang.c Subject: Re: Available No. of Registers Message-ID: <12982@sun.uucp> Date: Tue, 10-Feb-87 02:03:12 EST Article-I.D.: sun.12982 Posted: Tue Feb 10 02:03:12 1987 Date-Received: Wed, 11-Feb-87 07:17:20 EST References: <3950004@nucsrl.UUCP> <83@ucdavis.UUCP> <2250@jade.BERKELEY.EDU> <805@celerity.UUCP> Sender: news@sun.uucp Reply-To: guy@sun.UUCP (Guy Harris) Organization: Sun Microsystems, Mountain View Lines: 22 >My version of K&R states (page 193, section 8.1 "Storage Class Specifiers)": > A register declaration is best thought of as an auto declaration, > together with a hint to the compiler that the variables will be > heavily used. Only the first few such declarations are effective. > >This implies to me that a conforming compiler should allocate "registers" >starting with the first declaration. Well, no, I wouldn't go that far. The wording is too loose to be read as a requirement. The use of the word "hint" indicates that such declarations really aren't binding; the mention of the rules used by the compilers around at the time is there just to give the programmer an indication of which items would be put into registers. It's probably a Good Idea to process declarations in the Ritchie compiler/PCC fashion if you don't use any other information to decide which variables to put into registers, but it's probably a Good Idea to offer the programmer the option of using other information, since they may not know how many and what kind registers the machine the code is currently being compiled for has. Fortunately, the ANSI C standard does not promise which declarations will be effective.