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 →

What to know first

Related concepts

Questions about register keyword

What is 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.

Which Manning books explain register keyword?

Modern C, Third Edition and Modern C.

What should I know before learning register keyword?

Manning books that teach register keyword usually introduce compound literal, object and variable-length array first.

What is the difference between register keyword and address-of operator?

The register keyword is a C storage-class specifier for automatic objects that may request register storage and restricts taking the object's address. The address-of operator is a unary operator that produces a pointer to the object or function designated by its operand.

What is register keyword a kind of?

Register keyword is a kind of keyword. A language-defined word or token with a predefined syntactic or semantic role, which may be restricted from use as an ordinary identifier.

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.