The difference between BOOL and bool

Source: Internet
Author: User
BOOL is a standard C + + data type
BOOL is a standard C + + data type, and the value is true and false. A single byte, depending on the compiler, if several bool objects are listed together, each may take up a bit.
BOOL is a Microsoft-defined typedef int BOOL
BOOL is a Microsoft-defined typedef int BOOL. Unlike bool, it is a three-valued logic, True/false/error, with the return value of >0 as an integer of true,0 for False,-1 ERROR. 
One, 1. Different Types
BOOL is int type 
bool is Boolean type 
2. Different lengths
BOOL has only one byte 
bool length depending on the actual environment, generally considered to be 4 bytes 
3, take the value is different
BOOL evaluates to FALSE and true, the difference between 0 and 1 
BOOL evaluates to FALSE and true, and is the difference between 0 and non 0 
Two:

BOOL is a standard C + + data type, and the value is true and false. For a single byte,
Depending on the compiler, if several bool objects are listed together, each may take up a bit.

BOOL is a Microsoft-defined typedef int BOOL. Unlike bool, it is a three-valued logic,
True/false/error, the return value of >0 integer is true,0 for false,-1 ERROR.
Many functions that return a value of bool in the WIN32 API are three-valued logic. such as GetMessage (). Three:

The difference between big bool and small bool:
1. Different types
BOOL is int type
BOOL is a Boolean type
2. Different lengths
BOOL has only one byte
bool length depending on the actual environment, generally considered to be 4 bytes
3, take the value is different
BOOL evaluates to FALSE and true, is the difference between 0 and 1
BOOL evaluates to FALSE and true, is the difference between 0 and non-0
4. Examples
BOOL x=3; Alarm
BOOL X=1; That's right
BOOL x=3; That's right
BOOL x=3.3; Alert windows for the underlying variables defined for compatibility issues.

typedef unsigned long DWORD;
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef float 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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.