That bug stayed hidden in implicit AnsiChar for years...

That bug stayed hidden in implicit AnsiChar for years...
http://www.delphitools.info/2013/11/18/unicode-leftover-bug-from-hell/

Comments

  1. The conclusion - it's always safer to use constructs like `if ord(MyChar) <= 255` .

    ReplyDelete
  2. Eugene Mayevski Not really, if you do that, you move the problem to the Ord() and the MyChar encoding, as your 255 is then constant, but meaningless on its own.
    The compiler could have warned about the implicit conversion and the range for the set (like it does if you use the 4 digit notation), or better, they could have extended sets to work in the UCS2 range (ie. WideChar), which would also have avoided the CharInSet() kludge.

    ReplyDelete
  3. In case of ord() the charset conversion is under your control.

    ReplyDelete

Post a Comment