Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Feature] Nested union/structs #182

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

Open
lawm wants to merge 3 commits into WerWolv:master
base: master
Choose a base branch
Loading
from lawm:nested-struct
Open

Conversation

Copy link

@lawm lawm commented Jul 24, 2025

Adds nested struct and union definitions.

See WerWolv/ImHex#2197 and WerWolv/ImHex#363

There are no unit tests and I'm not familiar with the codebase. Please edit this pull request as needed.

demin-han reacted with thumbs up emoji
lawm added 3 commits July 23, 2025 18:35
This allows defining structs and unions inside another struct definition.
Example:
```c
struct a {
 u32 i ;
 struct b {
 u32 ii;
 };
 u32 ia;
 union u {
 u32 ui;
 char uc[4];
 };
 //u au; // warning: this will add another member of the union
};
a a @ 0;
```
The syntax is not exactly the same as C, and it's not anonymous, but at
least you don't need to move the definition out.
Example:
```
struct a {
 struct {
 u32 ii;
 };
 union {
 u32 ui;
 char uc[4];
 };
}
```
```c
struct a {
 struct {
 u32 ii;
 } sname;
 union u {
 u32 ui;
 char uc[4];
 } uname;
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /