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.)
So far
alignmakes 3D compute automatic alignment padding forstructs, but notcasetypes.Case 1: user-defined
casetypesWhile a user can arbitrarily nest
align structs as field members of acasetype, 3D currently provides no automatic mechanism to produce alignment padding for the wholecasetype. This would be useful forcasetypesrefiningC union types.Case 2:
#ifHowever, this should not be allowed if the
casetypewas 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 suchcasetypeis properly aligned.What should we do with:
Alignment padding after
foowill depend onMYCOND(2 or 6 bytes.)