BOOL is the Longbool type.
Delphi defines four types of Booleans: Boolean,bytebool,wordbool and Longbool. The following three types of Booleans are introduced for compatibility with other languages, and the Boolean type is generally recommended.
The four types of Boolean values that occupy memory are as follows:
Boolean 1 Byte
Bytebool 1 Byte
Wordbool 2 Bytes (1 Word)
Longbool 4 Bytes (2 Words)
For Bytebool,wordbool and Longbool, the value of the three type true constants is nonzero, false is zero, and can be verified with the ORD function;
For Boolean types, the value of the true constant is 1,false zero. In the context where the Boolean value is expected, the compiler converts Bytebool,wordbool and longbool three types of non-0 values to true.
However, Boolean expressions and Integer/real are incompatible in Delphi. The table below contrasts the similarities and differences between Boolean and Bytebool/wordbool/longbool:
Boolean
False < True
Ord (False) = 0
Ord (True) = 1
SUCC (False) = True
Pred (True) = False
Booltostr (True) =-1//This function is perverted.
Booltostr (False) = 0
Bytebool, Wordbool, Longbool
False <> True
Ord (False) = 0
Ord (True) <> 0
SUCC (False) = True
Pred (False) = True
Booltostr This function is the most puzzling, clearly said that the value of true is 1, and it tells us that true is-1. The prototype of the function is:
function Booltostr (B:boolean; Useboolstrs:boolean = False): string;
The following table is the conversion rule for a function:
B useboolstrs Value of returned string
True False '-1 '
True True trueboolstrs the first value of the array (default, ' True ')
False ' 0 '
False True Falseboolstrs The first value of the array (default, ' FALSE ')
http://blog.csdn.net/zisongjia/article/details/72963204
Delphi defines four types of Booleans: Boolean,bytebool,wordbool and Longbool. The following three types of Booleans are introduced for compatibility with other languages