does it matter how I construct an aggregate struct type if its size is the same?

Hayden Livingston halivingston@gmail.com
Fri Dec 18 06:47:00 GMT 2015


This may be a fundamental question, but does it matter how a struct is
constructed if its size is accurate to the receiving function? That is
if it was made up of all int8s vs. a combination of other types?

My scenario is that I have a receiving function whose actual struct
type information I do not know, but I know its size, so I was thinking
I could just build it up using int8 ffi_type and hope for the best.

Is this correct in the most popular ABIs (x86, x64, arm -
windows/Linux/macosx) that all the ABI and compilers that generate
code respecting those ABI care only about size and alignment?

I suspect so, but I'm not sure if there are quirks? Maybe on Windows?

Thanks!



More information about the Libffi-discuss mailing list