question about bool

This is a discussion on question about bool within the C Programming forums, part of the General Programming Boards category; hello guys, i have got a question about the bool data type. is the 'bool' datatype comes under 'C' datatypes. ...

  1. #1
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682

    question about bool

    hello guys,
    i have got a question about the bool data type. is the 'bool' datatype comes under 'C' datatypes. well, it might be a stupid question, i dont no. the thing i ask u about this b'cose, on the other day i used bool on DEV -C++ compiler which actually at the end should me an error telling me bool is undefined datatype. but i remember that i have used 'bool' which actually worked with some other compiler. but i cant remember whcih compiler it is. it is a along time i have used that compiler.

    ssharish2005

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,620
    bool is a basic type under C++ (bool, true, and false are reserved keywords in C++). In C99, a similar functionality is emulated using a set of macros and other things. Earlier versions of C did not include a bool type.

  3. #3
    Bond sunnypalsingh's Avatar
    Join Date
    Oct 2005
    Posts
    162
    Quote Originally Posted by grumpy
    bool is a basic type under C++ (bool, true, and false are reserved keywords in C++). In C99, a similar functionality is emulated using a set of macros and other things. Earlier versions of C did not include a bool type.
    Can u please elaborate on C99...hearing this for the first time

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    C99 refers to a particular standard of C. C89 is the standard the majority of compilers uses though many are moving towards C99 conformance. I'm sure searching the board would yield plenty of information

  5. #5
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    thax very much
    [/code]
    bool is a basic type under C++ (bool, true, and false are reserved keywords in C++). In C99, a similar functionality is emulated using a set of macros and other things. Earlier versions of C did not include a bool type.
    [/code]

    if this is the case, can u point some compiler which actualy support 'bool' data type. i think the dev-c++ dont though its a new compiler

    ssharish

  6. #6
    Bond sunnypalsingh's Avatar
    Join Date
    Oct 2005
    Posts
    162

    Thumbs down

    Quote Originally Posted by ssharish2005
    if this is the case, can u point some compiler which actualy support 'bool' data type. i think the dev-c++ dont though its a new compiler
    ssharish
    I don't know what version are you using...its better you download latest version of DEV C++(its free).....it does support bool

  7. #7
    Registered User
    Join Date
    Jun 2005
    Posts
    6,620
    Dev C++ is based on gcc (the Gnu Compiler Collection). Gnu C++ compilers have supported the bool type since the early to mid 1990s.

    If you compile source as C code, which is the default for files with a ".c" extension, there is a good chance that it will not support the bool type (unless you opt for 1999 C standard compliance).

  8. #8
    Registered User TactX's Avatar
    Join Date
    Oct 2005
    Location
    Germany.Stuttgart
    Posts
    65
    With C99 the keyword _Bool was introduced (among others). And there is a macro in stdbool.h called bool which expands to _Bool.

    It's propably a good idea to include stdbool.h, because even if your compiler does not support C99 it's still very likely that it has the stdbool.h (older non-C99 versions of gcc had it).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Curiosity question...
    By Raigne in forum C++ Programming
    Replies: 2
    Last Post: 04-05-2007, 10:49 PM
  2. need help program crashing
    By tunerfreak in forum C++ Programming
    Replies: 14
    Last Post: 05-22-2006, 12:29 PM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  4. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 05:25 AM
  5. c++ bool question pls help
    By rderiu in forum C++ Programming
    Replies: 9
    Last Post: 01-06-2003, 10:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21