-
Notifications
You must be signed in to change notification settings - Fork 51
Array accesses and bounds #634
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
base: main
Are you sure you want to change the base?
Conversation
This adds language documenting that out of bounds accesses for arrays is undefined behavior, and that zero-sized arrays are disallowed. This also restricts arrays of unknown size to strictly global resource declarations but allows omitting the array bound if it can be inferred from an initiailzer. Resolves microsoft#141
After the meeting today we seem to have alignment here. I'm going to mark this proposal as under review with PR microsoft#634 as the main review for the spec contribution.
After the meeting today we seem to have alignment here. I'm going to mark this proposal as under review with PR #634 as the main review for the spec contribution.
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.
LGTM!
\textit{D`} \terminal{[} \textit{N} \terminal{]} \opt{attribute-specifier-seq}\br | ||
\end{grammar} | ||
|
||
declares an array of \textit{N} \textit{T`}, where \textit{N} is the |
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.
what is the relationship between T and T'?
the contained type of an array be a complete type. | ||
\end{note} | ||
|
||
\p A declarator with an omitted array bound is valid if the when declaring an |
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.
remove 'if the' before when? or remove 'the when' after if?
|
||
\p A declarator with an omitted array bound is valid if the when declaring an | ||
object of array type which is not a non-static data member and is initialized | ||
with an initializer that follows the declarator. In this case the array bound is |
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.
is this only allowed for global declarations of resource objects? or for all array declarations?
This adds language documenting that out of bounds accesses for arrays is undefined behavior, and that zero-sized arrays are disallowed.
This also restricts arrays of unknown size to strictly global resource declarations but allows omitting the array bound if it can be inferred from an initiailzer.
Resolves #141