Type layout

Size, alignment and field offsets come from LLVM DataLayout for the compilation target.

Size

sizeof(T) returns the ABI allocation size of a type as nuint.

nuint integerSize = sizeof(int);
nuint vectorSize = sizeof(Vector3);

Alignment

alignof(T) returns the ABI alignment required for values of a type.

nuint alignment = alignof(Vector3);

Field offset

offsetof(T, Field) returns the byte offset of a struct field from the beginning of its containing value.

nuint yOffset = offsetof(Vector3, Y);
Sizesizeof(Vector3)
Alignmentalignof(Vector3)
Field offsetoffsetof(Vector3, Y)
Target model

Every result describes the selected compilation target, including cross-target object generation.