COHERENT manpages

This page displays the COHERENT manpage for register variable [Definition].

List of available manpages
Index


register variable -- Definition

register is  a C storage class.  A register  declaration tells the compiler
to try  to keep the defined  local data item in  a machine register.  Under
COHERENT C, the int foo can  be declared to be a register variable with the
following statement:

    register int foo;

The COHERENT C compiler makes three registers available for variables: ESI,
EDI,  and EBX.  Subsequent register  declarations  are ignored,  because no
registers are left to hold them.

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:

    register int i;
      . . .
    dosomething(&i);    /* WRONG */

This  rule applies  whether  or not  the  variable is  actually  kept in  a
register.

Placing  heavily-used   local  variables  into   registers  often  improves
performance,  but in  some cases declaring  register variables  can degrade
performance somewhat.

See Also

auto,
extern,
Programming COHERENT,
static,
storage class