Name
register storage class — Register storage class specifier
Synopsis
storage-class-specifier := register
The register
storage class is
like auto
: it can be used for local
objects and function parameters, and using it means that the declared
object has automatic lifetime. It also provides a hint to the compiler
that the object will be used frequently, so the compiler can optimize
access, perhaps by storing the object in a machine register.
Many modern compilers routinely ignore register
because the compilers are better
than humans at allocating registers.
Example
int foo(register
int parm) {register
int sqr = parm * parm; return sqr; }
See Also
auto
, type, Chapter
2
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.