U32/usize typo in Book?

In Casting between types -

There is a snipplet that says:

let a = 300 as *const char; // `a` is a pointer to location 300.
let b = a as u32;

Given that ptr can be 64bit, do we instead want ?

let b = a as usize;

Probably

I'd recommend looking at the stable book rather than other versions for completeness. Furthermore, yes, it should probably have been usize as opposed to u32 to be more universal.

@OptimisticPeach : Is there a way to tell Google to return results from the stable book instead of all the other versions? I'm almost never looking at the book's index, and almost always googling, i.e. "rust pointer to usize"

1 Like

Probably not, but the stable book has its own search feature (there is a little eyeglass icon at the top)... if that helps any.

1 Like

If the HTML < head >tag for each page contains < link rel="canonical" href="adress-of-stable-page" > , Google may choose to display that adress instead. They don't guarantee it, though.