liveBook · Manning

Register keyword

The register keyword is a C storage-class specifier for automatic objects that may request register storage and restricts taking the object's address.

How 2 Manning books explain it

Modern C, Third Edition

register is a C storage-class specifier that requests automatic storage for an object and permits implementation-specific restrictions on taking its address.

How it is used
Uses register to restrict address-taking and expose non-aliasing opportunities for automatic local objects.
How deep it goes
Explains automatic lifetimes, recursion, address restrictions, aliasing, and array complications, but does not develop compiler implementation details.
Examples
Uses local variables, recursive calls, non-array performance-critical variables, and arrays whose elements undergo address decay.
What you can do after
Apply register to selected local variables while preserving address-taking constraints and accounting for array behavior.

Read how Modern C, Third Edition explains register keyword →

Modern C

The register keyword is a C storage-class specifier that requests register storage and restricts use of the object's address in applicable contexts.

How it is used
Uses register declarations to restrict address-taking in local, performance-sensitive code and expose possible aliasing.
How deep it goes
Explains automatic lifetime, recursion, address prohibition, aliasing, and array limitations, but does not develop compiler implementation details.
Examples
Uses block-scope locals, recursive calls, address-taking, non-array variables, and arrays as contrasting cases.
What you can do after
Apply it via C declarations to diagnose unintended address-taking and communicate potential aliasing constraints to the compiler.

Read how Modern C explains register keyword →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.