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?


Thanks, Andrew. Where is this exception? In ABIs?

So you're suggesting I use char's to construct my ffi_types?

On Fri, Dec 18, 2015 at 3:08 AM, Andrew Haley <aph@redhat.com> wrote:
> On 18/12/15 06:46, Hayden Livingston 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?
>
> Yes, it does.  But there is a specific exception for character types:
> a character type is permitted to alias all other types.  So it's
> always safe to use an array of char, say, to hold anything.  (Without
> this rule, malloc() would not work.)
>
> Andrew.
>


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