.TH "register variable" "" "" Definition
.II "register declaration"
.PC
.PP
.B "register"
is a C storage class.
A
.B register
declaration tells the compiler to try to keep
the defined local data item in a machine register.
Under \*(CO C, the \fBint foo\fR can be declared to be a
register variable with the following statement:
.DM
	register int foo;
.DE
.PP
The \*(CO C compiler makes three registers available for variables:
.BR ESI ,
.BR EDI ,
and
.BR EBX .
Subsequent
.B register
declarations are ignored, because no registers are left to hold them.
.PP
By definition of the C language,
registers have no addresses, so you cannot pass the address of
register variable as an argument to a function.
For example, the following code will generate an error message when
compiled:
.DM
	register int i;
	  . . .
	dosomething(&i);	/* WRONG */
.DE
.PP
This rule applies whether or not the variable is actually kept in
a register.
.PP
Placing heavily-used local variables into registers often improves
performance, but in some cases declaring
.B register
variables can degrade performance somewhat.
.SH "See Also"
.Xr "auto," auto
.Xr "extern," extern
.Xr "Programming COHERENT," programmi
.Xr "static," static
.Xr "storage class" storage_c
