Available No. of Registers

guy at gorodish.UUCP guy at gorodish.UUCP
Tue Feb 10 17:03:12 AEST 1987


>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.



More information about the Comp.lang.c mailing list