Re:Let's write a setjmp
by layer8 on Sunday February 12, 2023 @12:03PM
(#34764460)
I would use a do-while, because at least one char is always copied:
The post-increment is idiomatic enough in C-based languages that I wouldn’t worry about that.
[ Parent
| on HN ]
I don’t write much C, but to an outsider like me this is a pretty big improvement.
It is a shame post-test loops aren’t more popular, given the similarity to the assembly they output. Seems more mechanically sympathetic. Oh well, at least it is an excuse to whip out the goto.
In Pascal, you could do
repeat
...
until c = 0;
which might be even clearer for this use case.