Get the latest tech news
Resizable structs in Zig
In this post I will make the case for the concept of a “runtime resizable struct” in Zig. I will then design an API by exploiting Zig’s powerful comptime functionality.
If you don’t track all of the lengths, you can accidentally introduce undefined behavior, and as a result, possible security vulnerabilities. We can actually achieve something sort of like this with some good ’ole Zig flavored comptime meta programming. The ResizableStruct(Layout) will act as a utility type that makes working with pointers to each field easier.
Or read this on Hacker News