liveBook · Manning

Integer promotion

Integer promotion is the implicit conversion of certain narrow integer operands to int or another suitable integer type before specified operations.

How 2 Manning books explain it

Modern C, Third Edition

Integer promotion is the implicit conversion of a narrow integer type to an integer type before certain C expressions are evaluated.

How it is used
Explains how narrow integers participate in arithmetic, comparisons, and certain function-call conversions.
How deep it goes
Defines the initial promotion step and connects it to common arithmetic conversions, but does not enumerate every conversion rule.
Examples
Uses char, _Bool, and short arithmetic, plus -1 + 1U and cosf(1) passed to printf.
What you can do after
Evaluate arithmetic expressions by identifying narrow operands and the subsequent signed, unsigned, or floating conversion steps.

Read how Modern C, Third Edition explains integer promotion →

Modern C

Integer promotion is the C conversion of a narrow integer type to int or another integer type before certain operations such as arithmetic.

How it is used
Explains the conversion applied before arithmetic and comparison involving narrow integer types.
How deep it goes
Defines the promotion rule and its typical signed-int result, but defers detailed platform-dependent widths and ranges.
Examples
Uses char and bool as prominent narrow types and classifies base types in a tabular overview.
What you can do after
Evaluate arithmetic and comparison expressions involving narrow integer types with the promotion rule in mind.

Read how Modern C explains integer promotion →

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.