Re:Show HN: Libconcurrent – Coroutines in C
by geocar on Wednesday January 13, 2016 @11:36AM
(#10895514)
Yes. You're likely to run into this construct often in C.
Lots of people do it because stupid C compilers produce better code for `for(;;)` than they do for `while(1)` and stupid C compilers used to be very common.
It's also one less character spent: A rare win/win.
Re:Show HN: Libconcurrent – Coroutines in C
by niccaluim on Wednesday January 13, 2016 @11:57AM
(#10895683)
Also it looks like a spider. That's why I use it, anyway.
Re:Show HN: Libconcurrent – Coroutines in C
by ghrifter on Wednesday January 13, 2016 @11:41AM
(#10895561)
Cool, thanks! I have yet to learn C other than from what I've learned from programming in C++.
I am really interested in learning some C however, especially after this post hit front page a few days ago:
Re:Show HN: Libconcurrent – Coroutines in C
by frik on Wednesday January 13, 2016 @12:23PM
(#10895899)
for (;;) { ... }
is a valid JavaScript and PHP syntax too. And used also as the first few chars of a JSON stream to prevent other sites consuming your internal API (e.g. Facebook uses it, Google+ uses while(1) { ... } which is longer).
Is this statement basically a do while/while(true) infinite loop?