Register Variables

The number and type of register variables in a function depend on the implementation. You can declare more variables as register than the number of physical registers the implementation uses. In such a case, the compiler treats the excess register variables as automatic.

Since the types that qualify for register class differ among implementations, invalid register declarations are treated as automatic.

If you declare variables as register to optimize performance, declare them in decreasing order of importance to ensure that the compiler allocates a register to the most important variables.

Microsoft C Specific

The compiler ignores register declarations if you select the global register allocation optimization. You can select global register allocation as follows:

Environment Selection

CL command line Specify either the /Oe or /Ox option.
PWB Select the Global Register Allocation option in the Optimizations dialog box.
pragma Use the optimize pragma with the e parameter.