This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]