VecInitAlignedT

Table of Contents

VecInitAlignedT

Description

Initialize given vector with given alignment. It is mandatory to initialize vectors before use. Not doing so is undefined behaviour. Provided alignment is used to keep all objects at an aligned memory location, avoiding UB in some cases. It’s recommended to use aligned vector when dealing with structs containing unions.

Parameters

NameDirectionDescription
vinVariable or type of a vector to be initialized.
alninVector element alignment. All items will be stored by respecting the alignment boundary.

Usage example (from documentation)

    Vec(Node) nodes = VecInitAligned(16);

    void SomeInterestingFn(DataVec data_vec) {
        // align items in "data_vec" at 128 byte boundaries
        data_vec = VecInitAlignedT(data, 128);

        // use vector
    }

Usage example (Cross-references)

No external code usages found in the scanned files.

Share :

Related Posts

VecForeachInRange

VecForeachInRange Description Iterate over elements in a specific range of the given vector v. This is a convenience macro that iterates over a range using an internally managed index. The variable var is declared and defined by this macro.

Read More

VecForeachPtrInRange

VecForeachPtrInRange Description Iterate over elements in a specific range of the given vector v (as pointers). This is a convenience macro that iterates over a range using an internally managed index and provides a pointer to each element. The variable var is declared and defined by this macro as a pointer to the vector’s data type.

Read More

VecInitT

VecInitT Description Initialize given vector. Default alignment is 1 It is mandatory to initialize vectors before use. Not doing so is undefined behaviour.

Read More