liveBook · Manning

Automatic storage

Automatic storage duration is a C storage duration in which an object's storage is associated with execution of its defining block or function.

How 2 Manning books explain it

Modern C

Automatic storage duration is a C storage duration in which an object's lifetime is associated with execution of its defining block, except for variable-length arrays and temporary objects.

How it is used
Distinguishes the runtime lifetime of ordinary local objects from other C storage durations.
How deep it goes
Defines categories and block lifetimes, explains recursive instances and register restrictions, and sets VLAs and temporary-object lifetimes apart.
Examples
Uses shadowed local variables and a saved pointer to separate identifier visibility from object lifetime.
What you can do after
Diagnose/debug with it by checking whether a local object's lifetime has ended and whether it was explicitly initialized.

Read how Modern C explains automatic storage →

Modern C, Third Edition

Automatic storage duration is a C storage duration in which an object's storage is created on entry to a relevant block or function and released when execution leaves it.

How it is used
Uses automatic storage to reason about local-object lifetime, recursive instances, and valid access separately from identifier visibility.
How deep it goes
Defines eligible automatic objects and the usual block-lifetime rule, while flagging VLAs and temporaries as exceptions.
Examples
Uses a shadowed local variable and a saved pointer, plus unoptimized and optimized gcc x86_64 assembler listings.
What you can do after
Diagnose/debug with it by checking whether a local object remains alive, including across shadowing and recursive calls.

Read how Modern C, Third Edition explains automatic storage →

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.