Hi all

Hi all,

if I have an integer num set to 0, then "not num" should return 1, right?

Delphi returns -1

Is this correct?

Comments

  1. What about: Result := 1 - num?

    ReplyDelete
  2. Uwe Raabe Yes that was my next thought. Thanks :-)

    ReplyDelete
  3. That not is a bitwise operation. Pascal overloads the operators. So not can be bitwise or boolean depending on the context. A bit confusing.

    The operator you look for is probably xor. That's the bit flipper.

    ReplyDelete

Post a Comment