logoalt Hacker News

jayemar • today at 3:52 PM • 1 reply • view on HN

Just out of curiosity how did you choose zig?


Replies

seletskiy • today at 6:20 PM

No particular reason. I've liked high-level capabilities that would translate into very low level code and amount of control, but on the other hand I couldn't use existing AVR backend because it produced very verbose code, so I ended up using Zig-to-C and avr-gcc, but it also produced subpar machine code which I was unhappy with. E.g. for loops that were bound by less than 255 iterations — 1 byte — it produced 4 instructions while 3 were enough, if I remember correctly). And for protocol implementations where timings are strict I've simply ended up with sprinkling code with ASM insets here and there to match timings. I also liked the fact that I could set ATTiny fuses straight in zig's comptime, but then they updated zig and that particular edge-case stopped to work.