Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <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.

                Turbo C++ uses the SI and DI registers to store any
                register variables.

                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: auto

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