-
Notifications
You must be signed in to change notification settings - Fork 165
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 note for array with empty struct or union #365
Conversation
Thanks for looking at this Kito. Quick high level comment: I think the case of a zero-length array of empty structs/unions should also be mentioned. Perhaps it's worth being more explicit about the case of a 1-sized array of an empty struct/union too? |
1ea95a3
to
950849a
Compare
Changes:
|
@nick-knight thanks for your comment and suggestion :) |
@asb @jrtc27 @luismarques did you mind take a review for that? I would like to have your review before I merge that :) |
Sorry, I shouldn't have approved this. What is there LGTM but it seems it doesn't explicitly cover all cases that @asb was asking about. Can you be more explicit about both the |
17e7bf4
to
ffead46
Compare
@luismarques added more description for zero-length array of empty structs/union, thank for the review :) |
Changes:
|
@kito-cheng the last round of grammatical suggestions from @nick-knight are marked as resolved but the changes don't seem to be reflected in the current version of the patch. It looks like they might have got lot along the way? I think I may have some additional minor grammatical or phrasing tweak suggestions after that, but it might be inefficient to comment if the version of the patch in this PR is an older version. |
@asb thanks for catch that...I must did something wrong during update this PR, updated now :) |
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 modulo the minor wording fixes suggested in line. Thanks Kito!
Fix #358 The key point of this issue is C and C++ having different type size for array of empty struct or union, size of empty struct or union is 0 for C, and 1 for C++, and the size of array is type size multiplied by the length of the array. Also checked AArch64 code gen, they also generated different code between C and C++, and ABI isn't explicitly describe this but has describe the size of array is type * length.
Thanks everyone :) |
Fix #358
The key point of this issue is C and C++ having different type size for array of empty struct or union, size of empty struct or union is 0 for C, and 1 for C++, and the size of array is type size multiplied by the length of the array.
Also checked AArch64 code gen, they also generated different code between C and C++, and ABI isn't explicitly describe this but has describe the size of array is type * length.