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.
The conclusion - it's always safer to use constructs like `if ord(MyChar) <= 255` .
ReplyDeleteEugene 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.
ReplyDeleteThe 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.
In case of ord() the charset conversion is under your control.
ReplyDelete