|
|
coherent
register variable Definition register variable
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 the COHERENT C compiler, the iinntt ffoooo can be
declared to be a register variable with the following statement:
register int foo;
COHERENT places the first two register variables declared in a
function into registers SI and DI if the variable type is ap-
propriate, i.e., int or SMALL-model pointer. Subsequent register
declarations are ignored, because no registers are left to hold
them. Note because of this fact, declaring more than two
register variables may slow processing rather than speed it.
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 im-
proves performance, but in some cases declaring register
variables can degrade performance somewhat.
***** See Also *****
auto, definitions, extern, static, storage class
COHERENT Lexicon Page 1
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.