There is a typo, but it's not with the &
.
The typo is that a & b == c
means a & (b == c)
when, at least to me, it looks like the author probably intended (a & b) == c
.
Now, don't be misled by the missing space — this is not a reference or an address-of operation or anything like that; it's a bitwise AND with the subsequent conventional whitespace omitted. In the mirror-image condition immediately after it you see a similar condition, except with bitwise OR and the whitespace included.
C++ doesn't really care about whitespace as long as tokens can be identified unambiguously, and it can identify them unambiguously based on what is valid where.
a &b
a & b
a& b
a&b
Given that a
and b
are already known to be expressions, the above four lines are equivalent.
Of course, if a
were a typename, then they would all be declarations (or parts of a declaration) of a reference called b
!
Those with sense, though, write the expression variety like this:
a & b
…and the declaration variety like this:
a& b
Some people with no sense write the declaration variety like this:
a &b
… but nobody I know would write the expression variety like that, because it's weird and confusing, as you've discovered. :)