-
I have searched open and closed issues and pull requests for duplicates, using these search terms:
-
I have checked the latest main branch to see if this has already been fixed, in this file:
URL to the section(s) of the book with this problem:
https://doc.rust-lang.org/book/ch20-01-unsafe-rust.html?search=static%20variables
Description of the problem:
Section 20.1 states that "In Rust, global variables are called static variables." This strongly suggests that global variables and static variables are one and the same, which is not true. Global variables are static variables (where static indicates that they live as long as the application) that have global lexical scope. The language supports the definition of static variables that have local scope, e.g., the scope of a function, similar to static variables in C. The book does not discuss this.
Suggested fix:
Describe global variables as static variables (where static indicates that they live as long as the application) that have global lexical scope. And indicate that static variables may be defined that have local scope.
I have searched open and closed issues and pull requests for duplicates, using these search terms:
I have checked the latest
mainbranch to see if this has already been fixed, in this file:URL to the section(s) of the book with this problem:
https://doc.rust-lang.org/book/ch20-01-unsafe-rust.html?search=static%20variables
Description of the problem:
Section 20.1 states that "In Rust, global variables are called static variables." This strongly suggests that global variables and static variables are one and the same, which is not true. Global variables are static variables (where static indicates that they live as long as the application) that have global lexical scope. The language supports the definition of static variables that have local scope, e.g., the scope of a function, similar to static variables in C. The book does not discuss this.
Suggested fix:
Describe global variables as static variables (where static indicates that they live as long as the application) that have global lexical scope. And indicate that static variables may be defined that have local scope.