Thursday, 7 July 2016

c++ - Why does double negation force values to become a bool?

If x was a 4 bit word like 1010, and you did the operation !!x,





  • Wouldn't the first !x return 0101,

  • And the second !(!x) return 1010?



Rather it returns ...0001 or ...0000. Why is this?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...