#pointer alignment guarantees
1 messages · Page 1 of 1 (latest)
Of course, if you do hacky enough stuff you can break that guarantee, but the language does enforce it with safety-checked UB wherever it can
np
if you want to double-check a type's natural alignment you can use @alignOf - e.g. chuck @compileLog(@alignOf(u64)) in your code and it'll print out the natural alignment of u64 during compilation
maybe you would also find it useful to assert that alignment at comptime, so your build errors out on platforms that don't have the alignment you're relying on. e.g. comptime std.debug.assert(@alignOf(u64) >= 8)