Skip to content
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

Support automatic alignment for casetype ? #145

Open
tahina-pro opened this issue Aug 23, 2024 · 0 comments
Open

Support automatic alignment for casetype ? #145

tahina-pro opened this issue Aug 23, 2024 · 0 comments
Assignees

Comments

@tahina-pro
Copy link
Member

So far align makes 3D compute automatic alignment padding for structs, but not casetypes.

Case 1: user-defined casetypes

While a user can arbitrarily nest align structs as field members of a casetype, 3D currently provides no automatic mechanism to produce alignment padding for the whole casetype. This would be useful for casetypes refining C union types.

Case 2: #if

However, this should not be allowed if the casetype was generated as a support for #if. Yet automatic alignment support may become harder for #ifs since the alignment may depend on the conditional. Rather, we should make sure each case of such casetype is properly aligned.

What should we do with:

aligned typedef struct _test {
  UINT16 foo;
#if MYCOND
  UINT32 bar;
#else
  UINT64 baz;
#endif
} test;

Alignment padding after foo will depend on MYCOND (2 or 6 bytes.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants