-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Reword explanation of 'size' types. #32906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Do not reference machine 'pointers' in explanation of 'size' types.
and unsigned varieties. This makes for two types: `isize` and `usize`. | ||
Rust also provides types whose particular size depends on the underlying machine | ||
architecture. Their range is sufficient to express sizes of collections and they | ||
are used to address items in a vector, for example. These types have ‘size’ as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the "for example" part misplaced or too much.
Simplify explanation and rephrase as per @GuillaumeGomez's suggestion.
Rust also provides types whose particular size depends on the underlying machine | ||
architecture. Their range is sufficient to express the size of any collection, so | ||
these types have ‘size’ as the category. They come in signed and unsigned varieties | ||
which makes for two types: `isize` and `usize`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"makes" -> "make"
|
@petrochenkov: I didn't understand that he said it was an implementation detail, on the contrary. |
@petrochenkov I think the reason I picked up on this when first reading the Rust book is that the introduction of integral types mentions pointers while pointers themselves have been moved (appropriately) towards the end of the chapter. I feel that for an introductory text, the notion of the »largest size you'd want to express« (ignoring special purposes such as file-system interfaces) succinctly describes the purpose of these types, while the reference should of course state that they are defined to be pointer-sized. |
Replace "make for" by the slightly more accurate "account for".
@bors: r+ rollup thanks! |
📌 Commit a548d4d has been approved by |
…labnik Reword explanation of 'size' types. Do not reference machine 'pointers' in explanation of 'size' types. I think the number of elements that can be directly addressed is a fundamental feature of a machine architecture in its own right. The fact that it coincides with the ‘size’ of a pointer should be viewed as an ‘implementation detail’ ;)
Do not reference machine 'pointers' in explanation of 'size' types.
I think the number of elements that can be directly addressed is a fundamental feature of a machine architecture in its own right. The fact that it coincides with the ‘size’ of a pointer should be viewed as an ‘implementation detail’ ;)