liveBook · Manning

Pointer-sized integer

As explained in Rust in Action: Systems programming concepts and techniques

isize is Rust's signed integer type whose width matches the target platform's pointer size.

isize is Rust’s signed integer type whose width matches the target platform’s pointer size. It is a word-length type, matching the width of the CPU’s registers. section 6.4.1

Pointer-sized integers connect Rust values to the machine’s address space. Memory addresses are represented as usize, while usize and isize share the platform’s pointer-sized width. section 6.4.1 section 6.1

Pointer-width memory words

A 64-bit operating system typically uses 4 KB pages, while a word represents a pointer-sized unit. Rust’s usize and isize correspond to that word size. section 6.4.1

Figure 6.1 Depicting notation used in this chapter’s figures for illustrating a pointer. In Rust, pointers are most frequently encountered as &T and &mut T, where T is the type of the value.

Use the pointer diagram to connect pointer-sized integers with runtime memory locations and Rust’s pointer notation. section 6.1

How Rust in Action: Systems programming concepts and techniques covers it

How deep it goes
Defines pointer-sized width and links it to CPU registers, but stops short of detailed isize operations or code examples.
Examples
Compares isize with word-sized memory units, pointer widths, CPU registers, and pointer diagrams.
What it assumes
Builds pointer and address-space vocabulary without requiring prior systems-programming experience.
What you can do after
Evaluate how a Rust integer’s width relates to pointers, memory addresses, and the target machine.
How it connects
Connects isize with pointers, memory addresses, address spaces, CPU registers, and virtual memory.

Also explained in

Compare how 2 books explain pointer-sized integer →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust in Action: Systems programming concepts and techniques. The section links point to the parts of the book it draws on.