For example, we have
char char1 = 0, char2 = 0;
This works fine:
char1 |= char2;
This does not:
char1 = char1 | char2;
The latter leads to "error: incompatible types: possible lossy conversion from int to char"
Why these options have different behavior?
Where "int" has emerged? According to Oracle:
- bitwise operators "can be applied to any of the integral types"
- char is an integral type