This is a userlevel implementation of the undefined keyword in Zig.
It is inspired by MaybeUninit in Rust.
Zigmaster
Each day will be tested in CI whether this project still builds on Zig master.
withByte as initializer function.inline, as the usage of inline was considered wrong.assume_init to assumeInit.as_ptr and as_mut_ptr to asPtr and asMutPtr.first_ptr and first_ptr_mut to firstPtr and firstPtrMut.@memset in MaybeUninit(T).zeroed() if T has a size of 0.MaybeUninit(noreturn) from being created. See https://github.com/ziglang/zig/issues/3603.first_ptr_mut from *Self to *T.first_ptr_mut on an empty slice.MaybeUninit from packed union to extern union, due to packed union’s setting the alignment always to 1.At the point of writing, it is impossible to create an uninitialized MaybeUninit(T), and later initialize it at compiletime.
This is an issue of the compiler, which tracks the current active field of packed and extern unions when used at compiletime, while it shouldn’t.
The issue is reported to the Zig compiler, and can be followed here.