-3

While readinf MuPDF comes across the source code line

x = !x;

Want to know what does the above code do?

While compilation is also gives error as

assuming signed overflow does not occur when simplifying 
condition to constant [-Werror=strict-overflow ]
Vineet1982
  • 7,730
  • 4
  • 32
  • 67
  • 4
    Are you sure the diagnostic is related to this statement? Can you remove it, compile and then put it back again and compile to confirm? – ouah Jan 25 '15 at 18:25

2 Answers2

6

!x will evaluate to either 0 or 1, depending on the value of x.

  • If x is 0, it evaluates to 1.
  • Otherwise, it evaluates to 0.
juanchopanza
  • 223,364
  • 34
  • 402
  • 480
1

Assuming x is boolean, this sets x false if it is true, and true if it is false.

Phil Lello
  • 8,377
  • 2
  • 25
  • 34