@cblake To my research Each platform (x86 arm powerpc) may have different 
alignment rules. But there is definitively no alignment rule distinction 
between compilers, otherwise it would be impossible to use structs as 
interfaces in C. This makes header files in C compatible between different 
compilers. This compatibility was never enforced or was defined, the C standard 
actually would allow different behaviours, but compiler manufacturers wanted 
compatibility and that is what we can rely on today.

I am aware of the `packed` attribute, I think nim should have the same.

To your last question. I think I can move the resolution of the alignment 
parameter to the runtime, but that would not only increase the complexity of 
the code a lot, but also remove the ability for compile time error checking.

As far as I know the target platform is already known at compile time, and 
therefore the generated C code is already platform dependent. This means it 
would not be wrong at all to generate platform dependent constants in the C 
code, because other platforms would have different C code anyway. 

Reply via email to