V1015. Suspicious simultaneous use of bitwise and logical operators.


The analyzer has detected a suspicious expression that uses logical and bitwise operations at the same time. One of those operations is probably mistyped.

Consider the following example:

void write(int s);
void write(unsigned char a, unsigned char b,
           unsigned char c, unsigned char d)
{
  write((a << 24) | (b << 16) || (c << 8) | d);
}

This is obviously a typo: the programmer used the '||' operator instead of '|' by mistake. The fixed code:

void write(unsigned char a, unsigned char b,
           unsigned char c, unsigned char d)
{
  write((a << 24) | (b << 16) | (c << 8) | d);
}

Bugs Found

Checked Projects
364
Collected Errors
13 504