VecInitAlignedT
- Macro
- August 22, 2025
Table of Contents
VecInitAlignedT
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
Name | Direction | Description |
---|---|---|
v | in | Variable or type of a vector to be initialized. |
aln | in | Vector 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.