should not mean exponentiation. Why the heck would anyone XOR a float? There is precedence for using the carat symbol for exponentiation in other languages.
Right, but what about when somebody does: a=2.0^5-1;
And expects it to work, i.e. get 31? You'd actually get 16. The problem is with the precedence, which was my point about bit-shift.
Ya, well, this would just be another stumbling block for newbies. Much like the fact that string s="Hi, ";s+="John!"; works, but string s="Hi, "+"John!"; does not. Many ugly things are produced because C++ attempts to be backward compatible with C. The precedence issues for << is even worse: cout << hex << setw(2) << setfill('0') << bitfield&0xff << dec;
Its meaning is obvious, but it fails miserably. If it were up to me, I would use the += operator for output, and the -= operator for input.
Oh, right, I forgot which end is "highest". Maybe "loosest" would be better.
anyway my point is that cout += x&0xff;
would be evaluated in the obvious manner, rather than trying to and 0xff with a reference to cout.