@greenmoonmoon that wouldn't be the level at which i would counteract it, as it's quite fragile to maintain.
better would be to explicitly memclear a buffer then init the fields in it - before passing the key to any hashmap function. at least that's my plan when i encounter this again.
@floooh @lritter @greenmoonmoon Yeah, surrounding the structs you want this on with:
#pragma pack(push, 1)
// structs
#pragma pack(pop)
That's right, right? Been a while since I learnt about that.
@pkhuong @floooh @miblo @greenmoonmoon these are not manually set up structs - they appear through the nudl codegen.
so i would have to ban unaligned table column configurations, and the only reason i could state for this is "because i am incompetent".
if i have no other course of action, i'll have to rewrite the relevant bits of stb_ds to use my macro type dispatch stuff. it's ok. just more work. 🫥
@lritter Let's say you have struct { int x; char y; double z; };
You'd have
```
enum
{
after_x = alignof(char) - (sizeof(int)) % alignof(char) % alignof(char),
after_y = (alignof(double) - (sizeof(int) + padding_after_x + sizeof(char)) % alignof(double)) % alignof(double),
...
}
```
and tail padding would use `alignof(union { one-of-every-type; })`.
and instead generate `struct {int x; char padding_after_x[after_x]; char y; char padding_after_y[after_y]; double z; char tail_padding[tail];}`.