Skip to content

Commit 401e559

Browse files
authored
Merge pull request #154 from gnzlbg/usize16
Document that isize/usize are at least 16-bit wide on all platforms we currently support
2 parents 103a2b5 + d8d7edb commit 401e559

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

reference/src/layout/scalars.md

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ The `isize` and `usize` types are pointer-sized signed and unsigned integers.
3737
They have the same layout as the [pointer types] for which the pointee is
3838
`Sized`, and are layout compatible with C's `uintptr_t` and `intptr_t` types.
3939

40+
> **Note**: C99 [7.18.2.4](https://port70.net/~nsz/c/c99/n1256.html#7.18.2.4)
41+
> requires `uintptr_t` and `intptr_t` to be at least 16-bit wide. All
42+
> platforms we currently support have a C platform, and as a consequence,
43+
> `isize`/`usize` are at least 16-bit wide for all of them.
44+
4045
> **Note**: Rust's `usize` and C's `unsigned` types are **not** equivalent. C's
4146
> `unsigned` is at least as large as a short, allowed to have padding bits, etc.
4247
> but it is not necessarily pointer-sized.

0 commit comments

Comments
 (0)