I'm using a compiler that is a lot more strict on the C language than normal (it's meant to help create less bugs in the code).
One thing I'm confused at is that it complains about the following line of code:
if ((timer == 0) && ((status & 0x100) == modval))
with:
Error: the right hand operand of an && or || operator should not contain side effects
So, can anyone see the side effect it's complaining about? As I certainly can't. Also, why is it specifc about the right hand side?
If I remove the "== modval" on the right hand side, I get the following additional error:
Error: this bitwise operation is in a boolean context
Which is understandable, as it doesn't evaluate to a proper boolean result, but rather assumes that true is anything apart from zero.
Still doesn't explain why it thinks "status & 0x100" gives a side effect tho'
EDIT: 'status' is a volatile. That explains it. Why only the right hand side though?