Why did Win32 define BOOL as a signed int instead of an unsigned int?

Raymond

Igor Levicki wants somebody from Microsoft to explain why BOOL was defined as a signed int instead of an unsigned int. You don’t need to work for Microsoft to figure this out. All the information you need is publically available.

Quoting from K&R Classic, which was the operative C standards document at the time Windows was being developed:

7.6 Relational Operators

The [relational operators] all yield 0 if the specified relation is false and 1 if it is true. The type of the result is int.

Win32 defined BOOL as synonymous with int because Brian and Dennis said so. If you want to know why Brian and Dennis decided to have the result of relational operators be signed instead of unsigned, you’ll have to ask them.

0 comments

Comments are closed. Login to edit/delete your existing comments