coderx123
coderx123

Reputation: 3

Warning in program

I get this warning if I try to run the code:

warning: expression result unused [-Wunused-value]

!!(((x&0xff)
| ((x >>  8) & 0xff)
| ((x >> 16) & 0xff)
| ((x >> 24) & 0xff))
& 0xaa);
return (x & 0xaaaaaaaa) != 0;

The code works fine. I just want to know why the warning is being generated.

Upvotes: 0

Views: 37

Answers (1)

Acorn
Acorn

Reputation: 26066

This statement:

!!(((x&0xff)
| ((x >>  8) & 0xff)
| ((x >> 16) & 0xff)
| ((x >> 24) & 0xff))
& 0xaa);

has no effect because you don't assign the result and there are no side-effects either.

Upvotes: 3

Related Questions