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?


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]