Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upbyteOffsetOf following non-abi-pointer-size-multiple array #5713
+60
−7
Conversation
|
Trying to figure out what I'm missing here. Can somebody confirm that the result of the test cases I added in the second commit are correct or if that is unintended behaviour? |
|
Note this is still broken: var p: P = undefined;
expectEqual(@ptrToInt(&p.i) - @ptrToInt(&p) = @byteOffsetOf(P, "i"));
This case could be said to be undefined behavior perhaps, but it's also broken when the first field is an array of bytes. |
|
Bump. Ready to inspect. The address of a packed struct member is a different, although related, issue. Regardless of how that one is fixed, this change will still make sense I think. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
vegecode commentedJun 25, 2020
•
edited
The second commit contains a test of @byteOffsetOf that resulted in a counter-intuitive answer (to me at least). Is that the intended behavior?