-
Notifications
You must be signed in to change notification settings - Fork 69
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
Unnamed struct members are skipped #233
Comments
It's not easy to support this C11 feature using bare Julia struct since Julia's struct doesn't have this kinda feature. However, as Julia allows us to overload In this way, non-canonical C structs/unions should be auto-generated as a struct with a single data byte field (e.g. To support this, |
Thank you for the quick & detailed response! Overloading Since just skipping the member results in misaligned fields afterwards, for now, maybe adding a warning when encountering such unnamed fields would be a good thing -- or just generating a name for the field? In my case it was rather obvious, but other people might be less fortunate, not realizing why their struct fields are misaligned after a skipped field. |
Hi @Gnimuc! Unfortunately I don't remember where exactly I used that and I'm not even sure if this ever ended up in a commit, sorry! I think what I did was simply performing an if on the symbol, then have an |
Hi, I've just tried master branch with the code presented by the OP and it fails with |
Which version are you using?
令和4年8月24日(水) 2:01 Cristóvão Duarte Sousa ***@***.***>:
… Hi, I've just tried master branch with the code presented by the OP and it
fails with ERROR: There is no definition for Meow's field: 's type:
[`union Meow::(anonymous at ......
Is that expected?
—
Reply to this email directly, view it on GitHub
<#233 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABYXW5O7HP37HIUYRM5VV53V2T7VVANCNFSM4IN55NKQ>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
I've tried it with Clang 0.16.0 and the current master branch, within Julia 1.8. |
I just noticed you used the example in the OP. |
Unnamed nested structures/unions are currently skipped.
Given
the lib generates the following Julia code:
The problem goes away when giving the member a name. Maybe generating a member called something along the lines of "anon_0" for these unnamed nested items would be best?
The text was updated successfully, but these errors were encountered: