Do C conditional statements always return [1 or 0], or do they return [0 or 'something other than zero']. I ask because:
pseudo code -
foo(address, shouldSend):
register >>= 1
register <<= 1 // to clear bit in first position
register |= shouldSend // to signal whether it should send or not
the problem occurs if somebody passin IN a shouldSend value of true greater than one (as only 0 is false and all else is true, technically this is valid). since i am directly OR'ing the truth value of shouldSend with the register, it better not be say 0xFF! i already have a solution, so the question is more for curiousity sake. i am wondering though if:
foo(address, shouldSend):
register >>= 1
register <<= 1 // to clear bit in first position
register |= (shouldSend > 0) // to signal whether it should send or not
solves the problem? i would think that now the problem of an 0xFF(or in general, something greater than 1) passed in is masked by the C conditional. but this only holds IF C conditionals are guaranteed to return [0 or 1].
ps - i also realize that it is probably compiler dependent, but what does the ansi standard say about this?