C
CBFalconer
Larry said:Maybe "average human beings" shouldn't try to write or
maintain non-trivial C programs.
That expression is true if an odd number of a, b, c, d,
and e are true.
- Larry
#define _(x) !!(x)
now your expression, including ensuring logical values, becomes:
_(a) ^ _b) ^ _(c) ^ _(d) ^ _(d) ^ _(e)
or
a ^ b ^ c ^ d ^ e
when the values are preknown to be logical, i.e. 0 or 1. In that
case you can also use:
(a + b + c + d + e) & 1
(and I believe the single _ to be a valid identifier)