-
Notifications
You must be signed in to change notification settings - Fork 59
Be more explicit about the layout guarantees of integer and floating-point types #98
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
393ef3e
to
b6d30c5
Compare
bf25d08
to
5f54e61
Compare
Closes rust-lang#102 .
5f54e61
to
d8ca372
Compare
reference/src/layout/scalars.md
Outdated
|
||
The layout of `usize` determine the following: | ||
|
||
- the maximum size of Rust values is _implementation-defined_, but can at most |
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.
Just noting that we use "value" to mean a very particular thing here -- the same thing that C calls "object", from what I can tell. Also see #40.
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.
A relatively easy way to avoid that issue while also being less jargon-intense would be to talk about the sizes of allocations. Just risks people thinking about heap allocation to the exclusion of all other kinds.
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.
@RalfJung once #40 is merged we should probably start linking these terms to their definitions (EDIT: i've added emphasis to the "values", but that doesn't help much).
@rkruppe with #40 we might be talking about the size of "places", which would remove the ambiguity with heap allocations, but it is still jargon heavy.
I was going through issue #9 and there it was mentioned that we wanted to guarantee that the fixed-width integer (and floating-point) types can interoperate with C's fixed-width integer and floating point types. Going through the text this felt implied, in particular, because C's fixed-width integer types guarantee some things that were not mentioned in the text (e.g. 2's complement for signed integers).
This PR attempts to call this out more explicitly. In particular in #9 there was a question about whether one should use, e.g.,
libc::uint8_t
in C FFI or whether usingu8
is ok. This PR explicitly mentions that usingu8
is ok.