-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add arrays of non-header types #1360
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Chris Dodd <[email protected]>
Should we in this PR also define literal syntax for arrays, e.g. perhaps something like |
In this section:
there is an explicit statement about accessing elements of header stacks that are outside of range:
Should that be generalized to reading an element of an array where the index is out of range for the array? Similarly later in that section for attempted writes to a header stack element it says:
Should that also be generalized to attempting to write to elements of an array where the index is out of bounds? |
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.
Looks good to me, I agree we should have exact semantics of out-of-bounds access as suggested in #1360 (comment).
[4] This is for array types that are not header stacks (the array element | ||
type is not a header or header_union) | ||
|
||
[5] Architectures may disallow arrays of arrays |
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.
nitpick:
[4] This is for array types that are not header stacks (the array element | |
type is not a header or header_union) | |
[5] Architectures may disallow arrays of arrays | |
[4] This is for array types that are not header stacks (the array element | |
type is not a header or header_union). | |
[5] Architectures may disallow arrays of arrays. |
This opens up the possibility of having nested arrays, which could potentially complicate array / header stack processing in some passes. We might consider explicitly prohibiting nested arrays until there is real motivation to support them. Related discussion: p4lang/p4c#5115 (comment) |
No description provided.