Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There's no casting involved in while(1). 1 is "true" in C, in fact, any integer != 0 is "true".

I just did a quick check and gcc -S produces the same ASM output for both of them, which doesn't include any comparisons whatsoever, just a jmp. So both of them are really compiled to an actual infinite loop.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: