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.

Example

 int foo(  register  int parm) {  register  int sqr = parm * parm;   return sqr; } 

See Also

auto , type , Chapter 2

   


C++ in a Nutshell
C++ in a Nutshell
ISBN: 059600298X
EAN: 2147483647
Year: 2005
Pages: 270
Authors: Ray Lischner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net