logoalt Hacker News

raymondtanayesterday at 3:57 PM1 replyview on HN

I've been learning Zig, and needed a refresher on memory layout (@sizeOf and @alignOf).

Wrote this blog post to summarize what I think are the right ways to understand alignment and size for various data types in Zig, just through experimentation.

Let me know any and all feedback!


Replies

dnauticsyesterday at 8:18 PM

i could be wrong but i believe the zig compiler reserves the right to lay things out differently depending on compilation mode? especially debug. unless it's extern or packed, in which case the layout will be defined.

show 1 reply