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

VecInitWithDeepCopyT

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

Read More

IterRemainingSize

IterRemainingSize Description Get remaining size left to read this memory iterator.

Read More

VecInit

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

Read More