Chapter 3 - Data Types in Rust Book

Hey there,

I noticed that Rust has isize and usize data types.

The book describes this as:

Additionally, the isize and usize types depend on the kind of computer your program is running on: 64 bits if you’re on a 64-bit architecture and 32 bits if you’re on a 32-bit architecture.

While the documentations says:

on a 32 bit target, this is 4 bytes and on a 64 bit target, this is 8 bytes.

target very probably means the target architecture that the Rust program is compiled for. Not which architecture the computer is running on. x64 OS's are capable of running x86 code, which means the text could be interpreted in a way that would suggest isize and usize are dynamic depending on which computer one runs the program. I don't think that's the case when I read the docs :slight_smile:

@steveklabnik
@carols10cents

Maybe clarify the text?

1 Like

Given that this is a very early chapter, I'm not sure that we want to get into cross-compiling :sweat_smile: So at this point, the computer compiling and running the code are the same. Perhaps we could change it to "the kind of computer the program is compiled for" without introducing too much confusion; please feel free to file a bug or PR.

4 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.