[swift-users] [swift-evolution] Padding structs

Alexandre Lopoukhine superlopuh at gmail.com
Tue Jan 19 13:10:51 CST 2016


That makes sense. Thank you.



> On 19 Jan 2016, at 20:02, Joe Groff <jgroff at apple.com> wrote:
> 
> 
>> On Jan 19, 2016, at 11:00 AM, Alexandre Lopoukhine <superlopuh at gmail.com> wrote:
>> 
>> Thanks Joe,
>> 
>> I was wondering which group I should write to, but I decided that part of the question was related to the evolution of swift.
>> 
>> The part related to current usage stems from trying to encode a struct containing a UInt8 and UInt32, and it taking up 8 bytes, unexpectedly to me.
>> 
>> The same happens with a tuple containing the same values.
> 
> A C struct would be the same size by default, since UInt32's natural alignment is to 4 bytes. Aligned accesses are generally much more efficient (though less so on recent Intel and ARM microarchitectures, I hear).
> 
> -Joe



More information about the swift-users mailing list