aardappel / lobster

The Lobster Programming Language
http://strlen.com/lobster
2.24k stars 121 forks source link

Struct packing rules should result to a size of 16. #217

Closed stolk closed 1 year ago

stolk commented 1 year ago

So, we really expect the struct size to be 16 here.

To be safe, I used <= 16 in case Visual C++ does something strange.

For struct, other than the alignment need for each individual member, the size of whole struct itself will be aligned to a size divisible by strictest alignment requirement of any of its members, by padding at end.

Fixes issue #216

aardappel commented 1 year ago

Apologies I pre-empted you.

Decided that if most compilers were going to add padding, might as well use that padding for larger fields, and get rid of all the (apparently not portable) packing trickery: https://github.com/aardappel/lobster/commit/3b2deb5289b87a8f1a67ef01ac0c448549b558b9