Get memory layout of a comptime anytype
Ziggit
Get memory layout of a comptime anytype
How do I get the memory layout of a comptime anytype? const std = @import("std"); fn foo(x: anytype) []u8 { return std.mem.asBytes(&x); } If we (or the compiler) make x comptime, this only works in debug mode (not sure if it should even work there) and in any of the release modes, this is undefined behaviour (no errors or warnings).
0 comments
No comments yet.