Bool and bool
Reprinted from: http://www.cppblog.com/Lee7/archive/2008/12/14/69394.html
I,
1. Different Types
Bool is int type
Bool is Boolean
2. Different Lengths
Bool has only one byte
The bool length depends on the actual environment. Generally, it can be regarded as 4 bytes.
3. Different values
Bool values: false and true, which are the difference between 0 and 1.
Bool values: false and true, which are the difference between 0 and non-0.
II:
Bool is a standard C ++ data type, which can be set to true or false. Occupies one byte separately,
If multiple bool objects are listed together, each bit may be occupied, depending on the compiler.
Bool is the typedef int bool defined by Microsoft. Unlike bool, It is a three-value logic,
True/false/error. If the returned value is greater than 0, the integer is true, the value 0 is false, and the value-1 is error.
In Win32 API, many functions with return values of bool are three-value logic. For example, getmessage ().
III:
Differences between large and small bool:
1. Different Types
Bool is int type
Bool is Boolean
2. Different Lengths
Bool has only one byte
The bool length depends on the actual environment. Generally, it can be regarded as 4 bytes.
3. Different values
Bool values: false and true, which are the difference between 0 and 1.
Bool values: false and true, which are the difference between 0 and non-0.
4. Example
Bool x = 3; // alarm
Bool x = 1; // correct
Bool x = 3; // correct
Bool x = 3.3; // alert
Note: Windows defines basic variables for compatibility issues.
Typedef unsigned long DWORD;
Typedef int bool;
Typedef unsigned char byte;
Typedef unsigned short word;
Typedef float;
Typedef float * pfloat;
Typedef bool near * pbool;
Typedef bool far * lpbool;
Typedef byte near * pbyte;
Typedef byte far * lpbyte;
Typedef int near * pint;
Typedef int far * lpint;