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

Alexandre Lopoukhine superlopuh at gmail.com
Tue Jan 19 13:00:45 CST 2016


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.


— Sasha




> On 19 Jan 2016, at 19:54, Joe Groff <jgroff at apple.com> wrote:
> 
> 
>> On Jan 19, 2016, at 10:53 AM, Joe Groff <jgroff at apple.com> wrote:
>> 
>> 
>>> On Jan 19, 2016, at 10:51 AM, Alexandre Lopoukhine via swift-evolution <swift-evolution at swift.org> wrote:
>>> 
>>> Hello everyone,
>>> 
>>> I have a question about structs in Swift. Is there a reason for the padding? Is there a plan to remove it, to make a more compact representation, making them similar to structs in C?
>> 
>> What are you referring to in particular? We do plan to change Swift's default layout strategy to minimize padding, but it's surprising that there are cases today where Swift structs have more padding than equivalent C structs.
> 
> Also, this is probably a better topic for swift-users than swift-evolution.
> 
> -Joe



More information about the swift-users mailing list