Skip to content
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

Spell out when arrays have zero size #162

Merged
merged 2 commits into from
Jul 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions reference/src/layout/arrays-and-slices.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ The _stride_ of the array is constant for all element pairs and it is computed
as the _size_ of the element type rounded up to the next multiple of the
_alignment_ of the element type.

### Arrays of zero-size

Arrays `[T; N]` have zero size if and only if their count `N` is zero or their
element type `T` is zero-sized.

### Special case `stride == size`

When the element _size_ is a multiple of the element's _alignment_, then `stride
Expand All @@ -42,6 +47,7 @@ pointer to the first element of the array by `i`[^1].

[layout of structs and tuples]: ./structs-and-tuples.md


### Layout compatibility with packed SIMD vectors

The [layout of packed SIMD vector types][Vector] [^2] requires the _size_ and
Expand Down