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

It will cause compiler errors, so it's not all that sneaky:

    int main(void)
    {
        while (1) break;
        return 0;
    }


It may rather than will. This ^ is a rather odd, syntax abuse case.


What do you mean? You will get a compiler error in any case where there is a break or continue in an outermost while block. There's nothing odd or uncommon about that. Here's something closer to a real program:

    int main(void)
    {
        while (1) {
            char c = getchar();
            if (c == 'q') break;
            process(c);
        }
        return 0;
    }


Ugh. You are right of course. I had a brain spasm.




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

Search: