3 ms·
Here's a fun one (not a fork bomb): int main() { printf("choo"); fork(); }
by m463 7y ago
Here's a fun one (not a fork bomb):
int main() {
printf("choo");
fork();
}
- hawkice 7y agoWhat's the fun part?
- m463 7y agoI won't tell you, let it be a surprise.
- hawkice 7y agoIt's more fun if you do things after you fork. Forking immediately before the process terminates is a noop for almost all use cases.
- hawkice 7y agoBecause deliberately obtuse hn comments do not benefit anyone: line buffers are copied on fork and flushed on exit, so you get two 'choo's. If you add a \n it goes down to just one because it flushes on newline.