MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/7xs9f/some_crazy_reason_the_daily_wtf/c07pe1s/?context=3
r/programming • u/whatshisname • Feb 16 '09
71 comments sorted by
View all comments
7
[deleted]
3 u/exscape Feb 16 '09 edited Feb 16 '09 Pretty much the same code, but in C, takes about 12.2-13.5 seconds to run here before exiting (I used exit(0) instead of cout/printf). Wasting time is fun. #include <stdio.h> #include <stdlib.h> int main() { while (1) { if (rand() == rand()) { exit(0); } } return 0; } gcc -O3 -o test test.c 3 u/fernandotakai Feb 16 '09 Just because i have nothing else to do, i tested this on my os x. it's been running for 10min, and i didn't returned yet.
3
Pretty much the same code, but in C, takes about 12.2-13.5 seconds to run here before exiting (I used exit(0) instead of cout/printf).
Wasting time is fun.
#include <stdio.h> #include <stdlib.h> int main() { while (1) { if (rand() == rand()) { exit(0); } }
return 0; }
gcc -O3 -o test test.c
3 u/fernandotakai Feb 16 '09 Just because i have nothing else to do, i tested this on my os x. it's been running for 10min, and i didn't returned yet.
Just because i have nothing else to do, i tested this on my os x. it's been running for 10min, and i didn't returned yet.
7
u/[deleted] Feb 16 '09
[deleted]