[Ilugc] [Technical] Does 'C' language specification has 'boolean' datatype ?

  • From: 0@xxxxxxxxxxx (0)
  • Date: Sat, 17 Dec 2011 15:14:48 +0530



No, C99 and stdbool.h are much more than that. It simply defines bool to be
_Bool which is not same as integer typedef you define.
_Bool is a full fledged boolean variable that can convert other values to 1
or 0 when stored according to standard rules in a transparent way. In fact
one need not use stdbool.h if one is happy with typing _Bool. (but not
recommended)


I suppose you mean _Bool to be a datatype (not variable). I was under 
the impression that it was all done in the headers but apparently not. 
Its nice to know there is a boolelan datatype. Although, it is wierd 
they chose _Bool instead of bool. I guess, that would break code which 
had already defined a bool macro. Talk about legacy stuff...

-- 
0

Other related posts: