liveBook · Manning

Unsigned integer

An unsigned integer is an integer type or representation whose values are nonnegative, with its representable range determined by its bit width and applicable rules.

How 9 Manning books explain it

Modern C, Third Edition

unsigned int is a C unsigned integer type that represents nonnegative whole numbers within an implementation-defined range.

How it is used
Uses unsigned types for nonnegative values, including sizes, and for arithmetic with a defined finite range.
How deep it goes
Derives the range from binary precision and describes modular arithmetic, then examines an unsigned object’s bytes.
Examples
Uses the set bits of 240 in a 16-bit type and a union that exposes an unsigned value’s bytes.
What you can do after
Evaluate/understand unsigned ranges and arithmetic, and distinguish a type’s numeric value from its implementation-defined byte order.

Read how Modern C, Third Edition explains unsigned integer →

Learn Rust in a Month of Lunches

An unsigned integer type represents nonnegative whole numbers without a sign.

How it is used
Represents nonnegative whole numbers using Rust primitive types.
How deep it goes
Defines unsigned values, lists type widths and limits, and explains how binary bits contribute to a number.
Examples
Uses the maximum values of u8 and u16 and a u8 variable cast to a character.
What you can do after
Apply it via a Rust type annotation to declare a u8 value and recognize its 255 maximum.

Read how Learn Rust in a Month of Lunches explains unsigned integer →

Modern C

An unsigned integer type is a C integer type whose representable values are non-negative.

How it is used
Uses unsigned integers to represent non-negative values, perform arithmetic, express sizes, and print numeric or bit-pattern representations.
How deep it goes
Defines the type family, ranges, promotions, operators, and output formats, but defers most operator rules to reference tables.
Examples
Uses `a + 5`, representative maximum values, `SIZE_MAX`, and `%u` or `%x` output formats.
What you can do after
Apply unsigned types in arithmetic and choose matching `printf` conversions for decimal values or bit patterns.

Read how Modern C explains unsigned integer →

Go in Action, Second Edition

An unsigned integer is an integer type that represents nonnegative whole-number values only.

How it is used
Distinguishes nonnegative integer storage from signed integers while guiding choices for arithmetic and function arguments.
How deep it goes
Defines ranges and architecture-dependent sizing, then works through underflow and an argument-validation failure.
Examples
Uses zero-minus-one subtraction and a negative configuration value passed through a uint conversion.
What you can do after
Apply it to choose an unsigned type where appropriate and validate nonnegative function input without relying on a uint parameter.

Read how Go in Action, Second Edition explains unsigned integer →

Learn C++ by Example

An unsigned integer is an integer type representing only nonnegative values within a fixed range using unsigned arithmetic.

How it is used
Uses unsigned arithmetic to examine range limits while warning against using it merely to prevent negative values.
How deep it goes
Explains range limits, overflow behavior, negative assignment, and the lost negative-value check, stopping short of implementation internals.
Examples
Uses a number triangle, row-count limits, signed overflow, unsigned wraparound, and assigning -2 to unsigned int.
What you can do after
Diagnoses overflow and representation mistakes without treating unsigned arithmetic as a general negative-value safeguard.

Read how Learn C++ by Example explains unsigned integer →

Learn Go with Pocket-Sized Projects

uint is Go's unsigned integer type whose size is implementation-dependent and corresponds to the native word size.

How it is used
Represents quantities that cannot be less than zero, such as occurrence counts stored in Go maps.
How deep it goes
Defines uint and demonstrates it in a map counter, without exploring integer representation or conversion rules.
Examples
Uses a booksCount function that records occurrences of books across bookworms and tests expected count maps.
What you can do after
Apply via Go map counters to record nonnegative occurrence totals.

Read how Learn Go with Pocket-Sized Projects explains unsigned integer →

Grokking Relational Database Design

An unsigned integer is a nonnegative integer representation without a negative sign.

How it is used
Guides selecting integer data types for nonnegative database attributes, especially numeric IDs.
How deep it goes
Defines signedness, compares capacities, and applies type selection to an identifier without detailing storage internals.
Examples
Uses signed and unsigned TINYINT limits, unsigned INT capacity, and payment_id type selection.
What you can do after
Evaluate database attributes and choose an appropriately sized integer type for nonnegative values.

Read how Grokking Relational Database Design explains unsigned integer →

Julia as a Second Language

An unsigned integer type represents nonnegative whole numbers within a fixed bit width.

How it is used
Uses fixed-width nonnegative values when representation or performance makes unsigned integers appropriate.
How deep it goes
Explains names, widths, limits, conversions, displays, and overflow context, while deferring unfamiliar number theory to an appendix.
Examples
Demonstrates UInt8 conversion, a UInt8 range error, hexadecimal display, and equivalent binary, octal, and decimal literals.
What you can do after
Evaluate/understand unsigned integer widths, bounds, conversions, and displays, then choose them deliberately rather than by default.

Read how Julia as a Second Language explains unsigned integer →

Fast Python: High performance techniques for large datasets

How it is used
Prevents pixel arithmetic from silently wrapping when brightening grayscale NumPy arrays.
How deep it goes
Demonstrates 8-bit overflow, then widens, clamps, and casts back; does not establish general integer-type rules.
Examples
Tests adding 5 to and doubling grayscale pixels, including 255 wrapping to 4 and doubling to 254.
What you can do after
Diagnose/debug with it: detect pixel-value wraparound, widen to uint16, clamp, and cast back to uint8.

Read how Fast Python: High performance techniques for large datasets explains unsigned integer →

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.