8 Sep
2006
8 Sep
'06
13:50
4 | 2 | 1 = 7
To be perfectly correct, 4+2+1 is *exactly* the same as 4|2|1:
Yes but only that speicific case.
The only time there's a difference between + and | is when the bit patterns of the numbers overlap. e.g., 3+1 ist not the same as 3|1:
binary 011 + 001 == 100 binary 011 | 001 == 011
It becomes important as you write code: S_IRUSR | S_IWUSR | S_IXUSR S_IRUSR + S_IWUSR + S_IXUSR as you cannot rely on S_I[RWX]USR being single-bit values. Jan Engelhardt --