register storage class

register storage class Register storage class specifier

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.


int foo(register int parm)


  register int sqr = parm * parm;

  return sqr;


See Also

auto, type, Chapter 2