16 questions
4
votes
2
answers
650
views
Usage of "stdbool.h" in Embedded systems
I am reading about the C-coding style for embedded systems and I found the following statement:
Do not use stdbool.h library. Use 1 or 0 for true or false
respectively
This statement was written in ...
-2
votes
2
answers
2k
views
What does <stdbool.h> do?
What does the <stdbool.h> do when using it in a C code?
I searched for it on the Wikipedia and didn't get answers in my language, i would love that someone will explain to me what it means.
1
vote
0
answers
38
views
Scan boolean value using library <stdbool.h> [duplicate]
is it possible to get a scanf of a value generated with the standard library '<stdbool.h>'?
For example if you wanted to scan the value of 'bool check;' where check is the name how can I do this ...
-1
votes
1
answer
101
views
Why do I get an error when I use %d in scanf when I use stdbool.h? [duplicate]
There are times when I use stdbool.h while practicing coding. At this time, if the format modifier of scanf is given as %d, the following error message occurs.
c:\project\hello\hello\hello.c(11): ...
2
votes
1
answer
134
views
Is failure to implicitly convert a pointer to _Bool a compiler deficiency?
Answers to this question state that scalars can be converted to _Bool and that the resulting integer value of the _Bool will be 0 or 1.
The accepted answer to this question points out that pointers ...
4
votes
2
answers
1k
views
Is (bool) cast reliably 0 or 1? [duplicate]
From some reading on Stack Overflow, I gather that bool, as defined in stdbool.h, is a macro that expands to the built-in type _Bool, and that true is defined as 1 and false is defined as 0.
Is ...
1
vote
2
answers
690
views
Why is scanf working abnormally for bool input in C?
I am trying to get input for 3 bool variables and 1 int variable. Even though I give input correctly, it is not behaving right.
I am using %d as format specifier for bool in stdbool.h as suggested by ...
3
votes
2
answers
1k
views
Why is stdbool.h deprecated? [closed]
The C standard now says:
The ability to undefine and redefine the macros bool, true, and false is an obsolescent feature and may be removed in a future version.
That is, stdbool.h is deprecated. ...
2
votes
1
answer
371
views
Why is C99's bool a macro rather than a typedef?
Why does the boolean type support introduced in C99 use the preprocessor rather than the language's own facilities? Specifically, why do we have:
#define bool _Bool
#define true 1
#define false ...
25
votes
3
answers
20k
views
Why use <stdbool.h> instead of _Bool?
Any time I had the need of a Boolean type I was told to either create one, or better yet, use stdbool.h.
Since stdbool.h uses typedef bool _Bool, is there a reason to use the header instead just ...
0
votes
4
answers
17k
views
Boolean in C Programming
So , unfortunately I encountered another problem with a program I'm trying to create. First of all I'm totally new to C Programming and I'm trying to create a Word Search .
I have this piece of code ...
0
votes
1
answer
300
views
What's the purpose of _Bool in C99? [duplicate]
As for stdbool.h, I can see some people wanting to have constants for true and false and a type named bool if only for clarity (though I'm not really one of them, personally).
However, what's the ...
2
votes
0
answers
3k
views
visual studio 2012 compiler does not recognize stdbool.h
I'm writing a header file for binary search tree, however when i compiled visual studio 2012 compiler does not recognized stdbool.h header.I got this error:
error C1083: Cannot open include file: '...
1
vote
1
answer
2k
views
MISRA C 2004 and c99
Rule 1.1 of the MISRA C 2004 specifies that the spec covers c90 and not c99.
I would like to use the stdint and stdbool libraries instead of coding my own. Has anyone made this exception in their ...
0
votes
2
answers
983
views
Building msgpack-python on Solaris 10 - Use of <stdbool.h> is valid only in a c99 compilation environment
I'm trying to build the python module msgpack-python on Solaris with the Sun compiler and am getting this error during the python ./setup.py build:
/opt/SUNWspro/bin/cc -DNDEBUG -O -xO3 -m32 -xarch=...