Basic module

NewArray

procedure · 1 overloadSource

Allocates count elements of T with context.allocator.

NewArray :: (
    count: s64,
    $T: Type,
    $initialized := true,
    alignment: s32 = -1
) -> (result: [] T, unaligned_base: *void)

The second result is the pointer the allocator gave out. Free that one, not result.data, which may have been moved forward to meet alignment.

Parameters

count: s64
$T: Type
$initialized := true
set to false to leave the elements as the allocator returned them.
alignment: s32
in bytes, a power of two. The type's own alignment when negative.

Returns

result: [] T
unaligned_base: *void

See also