crystal-book
crystal-book copied to clipboard
Inaccuracies in the `Struct` page
The Struct
page reads as follow:
The second point has a reason to it: a struct has a very well defined memory layout.
This may be very misleading as there is very few pieces of information on Crystal memory layout.
I would propose to add or modify the text to a content more on the idea of:
packed structs have a well defined layout, struct have a layout that is well defined within each platform, following the C layout for a struct on the same platform when relevant
Tangentially, it would be great to have references to Crystal's memory model - even if yellow-taped as unstable - for those of us writing memory-sensitive applications today. crystal tool hierarchy
has been very helpful, but the layout and cost of unions for example has been difficult to discover.