This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: does it matter how I construct an aggregate struct type if its size is the same?
- From: Hayden Livingston <halivingston at gmail dot com>
- To: libffi-discuss at sourceware dot org
- Date: Thu, 17 Dec 2015 22:50:10 -0800
- Subject: Re: does it matter how I construct an aggregate struct type if its size is the same?
- Authentication-results: sourceware.org; auth=none
- References: <CAMxMwy+ATViiyo4Znn4-jhmoKNEDWbHUxFPOmK6sX9_Lxd_j0w at mail dot gmail dot com>
I understand that this maybe a systems programming general question
that is not specific to libffi, but I'm asking here since I know some
of you will know this and of course I'm using libffi.
On Thu, Dec 17, 2015 at 10:46 PM, Hayden Livingston
<halivingston@gmail.com> wrote:
> 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!