Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>register register data storage class</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
register                 Register Data Storage Class

    The register class specifies that an object is to be created
    dynamically and--whenever possible--stored in an actual machine
    register. Designating a variable as register class can provide speed
    gains and a reduction in code generation. The register keyword may
    only be used internal to a function. A register variable is created
    when its parent function is invoked, and destroyed when that function
    exits. A register object has temporary life and its scope is limited
    to the block in which it is declared, and all subordinate blocks (if
    any).  The format of a declaration that specifies register class is:

         register [type] identifier [[= initializer], ... ] ;

      Notes:    The initial value of a register variable is undefined if
                it is not explicitly initialized, either in the
                initializer list or via assignment. The initializer
                expression can be any valid run-time expression,
                including function calls.

                Whether the variable is actually stored in a machine
                register is implementation-defined, as is the number of
                machine registers available for register variables.

                In MS-C, registers (if avaialble) are allocated in the
                order the register declarations are seen by the compiler;
                declare the most important ones first.

                Only int and pointer types can be stored in registers in
                MS-C. Although the usage of register with all other types
                is syntactically correct, it has no meaning.

                MS-C uses the SI and DI registers to store any register
                variables so you must preserve them when interfacing with
                other languages.

                If the type is omitted type int is assumed.

                Formal arguments in a function definition may have class
                register, in which case they are copied from the calling
                stack into a register, where possible.

                Excess register variables are treated as if they had
                class auto.
  -------------------------------- Example ---------------------------------

           register int max = 1234;
           register struct node *next;
           register int r1 = 10, r2 = r1 + 20;

           int sum(arg1, arg2)
           register arg1;
           int arg2;
           {
                ...
           }

See Also: Classes auto

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson