News for hackers. Stuff that matters.
Re:Zig in 30 Minutes by Leherenn on Monday January 04, 2021 @04:36AM (#25629235)
Yeah, it's not that common in general, I agree. I think my impression was coloured by the fact I tried Zig to implement a binary protocol deserialiser where getting the size first then iterating happened a lot.
Re:Zig in 30 Minutes by AnIdiotOnTheNet on Monday January 04, 2021 @07:36AM (#25630520)
The pattern I use for that is:

  get size
  allocate slice
  for(slice) |*elem| elem.* = read()