次の方法で共有


register Keyword

The register keyword specifies that the variable is to be stored in a machine register, if possible.

register declarator ;

Remarks

For example:

register int var;

Microsoft Specific

The compiler does not accept user requests for register variables; instead, it makes its own register choices when global register-allocation optimization (/Oe option) is on. However, all other semantics associated with the register keyword are honored.

END Microsoft Specific

ANSI C does not allow for taking the address of a register object; this restriction does not apply to C++. However, if the address-of operator (&) is used on an object, the compiler must put the object in a location for which an address can be represented. In practice, this means in memory instead of in a register.

See Also

Reference

Storage-Class Specifiers

C++ Keywords