Hacker News new | ask | show | jobs
by Leherenn 1999 days ago
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.
1 comments

The pattern I use for that is:

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