Proposal: Allow aligned zero-size pointers #6954
Labels
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Zero-sized pointers are really inconsistent about alignment.
I see two ways to resolve this:
Never allowing alignment causes a lot of special cases for zero sized types. So I think we should standardize alignment. In all places, we have the invariant that
@alignOf(T) <= @sizeOf(T)
. This means the only valid alignment for zero-sized types is0
. Which kind of makes sense, you could argue that they are bit packed. Defining the alignment this way isn't perfect but definitely cuts down on the number of special cases with zero-sized types.The text was updated successfully, but these errors were encountered: