Thread: is bool.h part of ansi c?

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    31

    is bool.h part of ansi c?

    If they aren't I know it's possible to make a bool type using define macros. The reason I'm wondering is because I'm thinking about programming with MFC.

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    There is no bool.h specified in any C standard.

    There is a stdbool.h specified in the 1999 C standard, which defines macros bool (which expands to a reserved keyword named _Bool), true (which expands to 1), and false (which expands to 0).

    The 1989 C standard specified no such thing. MFC is somewhat older than 1999, so might not interact with the macros in stdbool.h as you expect.

  3. #3
    Registered User OnionKnight's Avatar
    Join Date
    Jan 2005
    Posts
    555
    Windows uses it's own bool type called BOOL that has the values TRUE and FALSE.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by OnionKnight
    Windows uses it's own bool type called BOOL that has the values TRUE and FALSE.
    More accurately, the win32 API employs a type called BOOL (which is a typedef for a simple int, which is 32 bits). It won't take much thought to work out what TRUE and FALSE are defined as.....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get a part of a string from a point onwards
    By pseudonoma in forum C Programming
    Replies: 2
    Last Post: 03-22-2008, 04:09 PM
  2. How to know if my code is ANSI strict ?
    By jabka in forum C Programming
    Replies: 1
    Last Post: 10-19-2007, 07:32 AM
  3. Replies: 9
    Last Post: 07-11-2006, 04:28 AM
  4. Suspicious Pointer Conversion
    By mr_spanky202 in forum C Programming
    Replies: 35
    Last Post: 04-11-2003, 12:35 PM