Hi,
I'm using the ST32F103G uC and Keli uVision 4.22 IDE.
Something that I don't understand is how to use single bits as variables or as a function return value. With other compilers I know 'bit' and 'bool' but somehow this doesn't seem to work with the armcc compiler. I searched the Internet but could not find anything in that direction.
Who can help me out?
Thanks in advance,
Henk
"... mapping bool to int or char."
However, the mapping and implementation of boolean semantics becomes the responsibility of the user:
typedef int _Bool; _Bool is_nonzero; int value = 1234; { is_nonzero = !!value; }
{ is_nonzero = !!value; }
I would prefer to write:
{ is_nonzero = value != 0; }
I expect some people will look twice (pun intended) at a !! expression.
The second alternative can be read explicitly as "valie is not equal to zero" or shorter "value is not zero".
My typedef of a Bool (coming from years back) has always been of the form:
typedef unsigned char Bool; // TRUE/FALSE(/MAYBE) type conditions