Share this page

# register

A Storage-Class Specifier that defines a local variables to be stored in a register instead of RAM. This means that the variable has a maximum size equal to the register size (usually one word) and may not have the unary '&' operator applied to it (as it does not have a memory location).

You should only use register for variables that require quick access such as counters. Note that defining a variable as a register type, does not mean that the variable will be stored in a register. It means that it MIGHT be stored in a register, depending on the hardware and implementation restrictions.

Note: VuGen, like most compilers, ignores the register declaration.

## Example

In the following example, 3 register long variables are defined, a, b and c.

        unsigned long buf[3] ;
        register unsigned long a, b, c;
        buf[0] = 1;
        buf[1] = 3;
        buf[2] = 5;
        a = buf[0];
        b = buf[1];
        c = buf[2];
        lr_output_message ("values are: %ld %ld %ld", a, b, c);

    Example: Output:
    Action.c(14): values are: 1 3 5

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: