#StructPack [v2.1-alpha.19+]

Sets the maximum alignment requirement for subsequent typed properties.

#StructPack Setting

Parameters

Setting

Type: Integer

If omitted or 0, alignment requirements are reset to default. Otherwise, specify 1, 2, 4 or 8 to set an a maximum requirement for the current class or module.

Remarks

The value set by this directive directly corresponds to the Pack value passed to DefineProp when the class is initialized. Each struct field declared within a class definition uses the pack value set by the most recent #StructPack directive within the current class, enclosing class or module.

This directive can be used multiple times within a class, and will only affect subsequent fields.

The alignment requirement of the class itself is that of its strictest member (the field with the largest alignment requirement).

Structures

Examples

Disable padding in one struct class.

class AB1 {
    #StructPack 1
    a : Int8
    b : Int32
}
class AB2 {
    a : Int8
    b : Int32
}
MsgBox "AB1: " AB1.Prototype.GetOwnPropDesc('b').Offset
MsgBox "AB2: " AB2.Prototype.GetOwnPropDesc('b').Offset