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

If __JCR_END___ was always a boolean, yes.


Am I missing something? '==' has a higher precedence than '||', so it should always evaluate as true.


I think the catch he's getting at is that || imposes an ordering that the left side is checked before the right side. This also implies that any side-effects of the left side have to happen before the right-side is evaluated.

That said, I still don't know how you could get this code generated. If you make an equivalent piece of code with _JCR_END__ as a volatile int, you still get an infinite loop which has the mov op for reading the _JCR_END__ value but it doesn't bother to test it. IE. gcc still reads the variable but optimizes the loop to a while (1). I can't think of anyway to trick gcc into generating asm like this.




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

Search: