>
>
>
V6119. The result of '&' operator is al…


V6119. The result of '&' operator is always '0'.

The analyzer has detected a bitwise 'AND' (&) operation with operands that cause the result to always be zero. It is possible that an invalid operator or operand is used.

An example:

final int ACCESS_READ = 0b001; 
final int ACCESS_WRITE= 0b010; 
final int adminMask = ACCESS_READ & ACCESS_WRITE;  // <=

A developer creates a mask of bit flags (the 'final' of variables) to access file operations. As a result of the bitwise 'AND' operation, all bits in the 'adminMask' variable become equal to 0, and the mask becomes unnecessary.

The correct way to create a mask is as follows:

final int adminMask = ACCESS_READ | ACCESS_WRITE;

This diagnostic is classified as: