Open
Description
The slide on static
s gives this example:
static BANNER: &str = "Welcome to RustOS 3.14";
Then it describes how the item has a stable address. While this is true, it's confusing because the visible part of the value (the string data) is not actually stored in the static, and the string data itself has a fixed address not due to being part of a static but merely because that's how string literals work.
It would be a bit clearer if we used a type with no indirections such as u32
or [u8; N]
so that there aren't multiple layers of pointers involved. Perhaps something like:
static BANNER: [u8; 22] = *b"Welcome to RustOS 3.14";
Metadata
Metadata
Assignees
Labels
No labels