Available No. of Registers

Mark Nagel cccmark at ucdavis.UUCP
Mon Jan 19 07:17:46 AEST 1987


In article <3950004 at nucsrl.UUCP> ram at nucsrl.UUCP (Raman Renu) writes:
>   C allows "register ......" construct which instructs the compiler
>to reserve a machine register to store that value.  Now my question is,
>given a fixed number of registers, How many are effectively usable for
>the register declaration.  I know this is machine dependent.  Could
>somebody say how many register definitions I could use within a block
>of code say for a VAX.  And please go on to mention the CPU/Machine that
>allows the greatest number and smallest number of such declarations. 

On the machines I've worked on, the register declaration will use up to
the total available registers on the CPU and then it is ignored (i.e. no
error, just no register declaration either).  Depending on the compiler,
the register declaration will do anything from telling the compiler to put
this variable in an available register or else (Macintosh w/Lightspeed C)
to strongly advising the compiler to possibly put the variable in a register
if it wouldn't be too much trouble (VAX/VMS C).  I am not sure of exact
numbers offhand, but they will vary according to compiler as well as CPU.


- Mark Nagel

ucdavis!deneb!cccmark at ucbvax.berkeley.edu               (ARPA)
mdnagel at ucdavis                                         (BITNET)
...!{sdcsvax|lll-crg|ucbvax}!ucdavis!deneb!cccmark      (UUCP)



More information about the Comp.lang.c mailing list