liveBook · Manning

Signed integer arithmetic

Signed integer arithmetic is arithmetic performed on values of signed integer types, including negative and nonnegative values and subject to signed representation and overflow rules.

How 2 Manning books explain it

Modern C, Third Edition

Signed arithmetic is arithmetic performed on values of signed integer types, with results subject to the rules for signed representations and overflow.

How it is used
Explains how signed values represent negatives, perform arithmetic, compare, and behave when results exceed their range.
How deep it goes
Explains two’s complement and compiler consequences of overflow, but defers broader undefined-behavior analysis.
Examples
Uses bitwise negation, sign detection, signed comparison, and contrasting unsigned and signed counter loops.
What you can do after
Diagnose why signed-overflow code cannot be reasoned about as wrapping arithmetic and may be optimized into an infinite loop.

Read how Modern C, Third Edition explains signed integer arithmetic →

Modern C

Signed integer arithmetic is arithmetic performed on C integer operands whose types represent negative as well as non-negative values.

How it is used
Explains how negative values are represented and why signed overflow invalidates assumptions about program execution.
How deep it goes
Connects two’s-complement bit operations to compiler optimization, but focuses on overflow consequences rather than a complete representation taxonomy.
Examples
Uses negation of 240, paired signed and unsigned counter loops, and an optimized infinite-loop consequence.
What you can do after
Diagnose signed-overflow hazards and avoid treating their results as predictable wraparound.

Read how Modern C explains signed integer arithmetic →

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.