liveBook · Manning

Volatile qualification

Also called volatile qualifier

In C, volatile qualification marks an object whose accesses may have externally observable effects or whose value may change independently of ordinary program execution.

How 2 Manning books explain it

Modern C, Third Edition

The C volatile qualifier specifies that accesses to an object may have externally observable effects and must not be treated as freely eliminable or cacheable by the compiler.

How it is used
Uses volatile to protect accesses in timing loops, long-jump paths, and signal communication from inappropriate optimization.
How deep it goes
Explains access and optimization effects through generated code and control-flow examples, including measurement overhead and the limits of volatile for signals.
Examples
Compares timed loops with a volatile counter or store and qualifies a depth counter used across a long jump.
What you can do after
Apply volatile where needed in measurements and long-jump paths, and evaluate its limitations for signal-handler communication.

Read how Modern C, Third Edition explains volatile qualification →

Modern C

A volatile qualification is a C type qualifier indicating that an object's value may change independently of ordinary program execution and must not be optimized away from accesses.

How it is used
Uses volatile to preserve accesses in loop measurements and values needed after nonlocal jumps.
How deep it goes
Explains access and optimization consequences, compares generated loop instructions, and illustrates qualification across long jumps.
Examples
Compares timed loops with a volatile counter or store and qualifies a recursive parser’s nesting depth.
What you can do after
Apply volatile qualification to preserve benchmark accesses and local values needed after longjmp.

Read how Modern C explains volatile qualification →

Also covered in

What to know first

Related concepts

Questions about volatile qualification

What is volatile qualification?

In C, volatile qualification marks an object whose accesses may have externally observable effects or whose value may change independently of ordinary program execution.

Which Manning books explain volatile qualification?

Modern C, Third Edition and Modern C.

What should I know before learning volatile qualification?

Manning books that teach volatile qualification usually introduce exception, lock-free, locking and performance optimization first.

What is the difference between volatile qualification and performance optimization?

In C, volatile qualification marks an object whose accesses may have externally observable effects or whose value may change independently of ordinary program execution. Performance optimization is the systematic modification of a system or its operation to improve performance measures such as speed, responsiveness, throughput, or resource efficiency.

What is volatile qualification also called?

Volatile qualification is also called volatile qualifier.

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.