Off topic to the original thread....Afaik there are API calls (kernel, etc) that may return "boolean", but with -1 or even just non-zero for true.
But maybe there are other reasons....
Anyway, "boolean" in Pascal has exactly 2 values: true and false. And it only deals with those 2 (and there exact ordinal values 0 and 1).
Forcing any ordinal that is not the ordinal of true or false into "b" is invalide code, and will not work. And is not expected to work.
So as far as I can see, this is exactly what it should be.
In order to deal with API calls as those mentioned, there are additional types in Pascal. E.g. "ByteBool".
- ByteBool is not (type) boolean.
- ByteBool behaves like boolean.
- ByteBool can be assigned to boolean.
- ByteBool is a type of its own (just like byte or word are types of their own)
ByteBool treats non-zero as true.
is internally translated into
MyBoolean := Byte(MyByteBool) <> 0;
And therefore the boolean will store the value "true" with an ordinal value of 1.
And that has been existed for a long time (maybe not in Turbopascal, I have not checked). However it does not break "boolean", it just adds additional types.
And nothing mentioned here has made any change to that.
The only issue that Thaddy is for some obscure reason mixing into this thread is, that there is an type-alias "cbool" (in unit ctypes) which was reviewed for being changed to alias another type than it has aliased before. (follow the link that Thaddy posted).
That "cbool" issue has not affected the bug of the original post.