liveBook · Manning

Narrow type

A narrow type is a C integer or character type whose values undergo integer promotion before arithmetic evaluation.

How 2 Manning books explain it

Modern C

A narrow type is a C integer or character type whose values undergo integer promotion before arithmetic evaluation.

How it is used
Deploys narrow types for character data, Boolean values, byte inspection, and memory-efficient storage rather than arithmetic.
How deep it goes
Defines promotion, range variation, and practical restrictions, but defers detailed operator conversion rules.
Examples
Uses `short`, `char`, `bool`, `unsigned char`, oversized assignments, and byte-wise inspection of an unsigned integer.
What you can do after
Evaluate narrow-type choices and avoid unintended arithmetic or information loss from promotion and narrowing conversions.

Read how Modern C explains narrow type →

Modern C, Third Edition

A narrow type is a C integer type that undergoes integer promotion before being used in an arithmetic expression.

How it is used
Explains why certain C integer types are converted before arithmetic expressions are considered.
How deep it goes
Defines promotion behavior and implementation variation, but does not provide a worked expression or compiler output.
Examples
Uses char and bool as prominent narrow types and Table 5.1 as a classification reference.
What you can do after
Evaluate arithmetic involving char, bool, and other narrow integers by accounting for promotion to signed int.

Read how Modern C, Third Edition explains narrow type →

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.