Click here to Skip to main content
15,886,873 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: To bool or not to bool in C/C++ ? Pin
Stephane Capo20-Feb-20 21:55
professionalStephane Capo20-Feb-20 21:55 
AnswerRe: To bool or not to bool in C/C++ ? Pin
Richard MacCutchan20-Feb-20 22:00
mveRichard MacCutchan20-Feb-20 22:00 
AnswerRe: To bool or not to bool in C/C++ ? Pin
Victor Nijegorodov20-Feb-20 22:08
Victor Nijegorodov20-Feb-20 22:08 
GeneralRe: To bool or not to bool in C/C++ ? Pin
Vaclav_21-Feb-20 10:18
Vaclav_21-Feb-20 10:18 
GeneralRe: To bool or not to bool in C/C++ ? Pin
k505421-Feb-20 10:51
mvek505421-Feb-20 10:51 
AnswerRe: To bool or not to bool in C/C++ ? Pin
Stefan_Lang21-Feb-20 0:31
Stefan_Lang21-Feb-20 0:31 
AnswerRe: To bool or not to bool in C/C++ ? Pin
Vaclav_21-Feb-20 5:30
Vaclav_21-Feb-20 5:30 
GeneralRe: To bool or not to bool in C/C++ ? Pin
Richard MacCutchan21-Feb-20 5:54
mveRichard MacCutchan21-Feb-20 5:54 
You are mixing C and C++, which only adds to your confusion. C++ and ANSI C are two distinct languages.

Vaclav_ wrote:
C++ has "type" bool but evaluates to something called "true " or "false" which in reality is "something / application/ os " or whatever dependent and hides the binary value ...
No. The bool type in C++ is exactly that, a boolean type, and is part of the language, nothing to do with the operating system. A statement like
C++
bool someVariable = true;
while (somevariable)
{
    // do stuff
}

will continue until it encounters
C++
someVariable = false;

But if you try
C++
someVariable = 1;

the compiler may accept it byut you should not rely on it, as future compilers may well not accept it.

And conversely if you try the first two in C the compiler will not know what you are talking about. Decide which language you want to use and stick to it, it will save you a lot of confusion.
GeneralRe: To bool or not to bool in C/C++ ? Pin
Vaclav_21-Feb-20 8:29
Vaclav_21-Feb-20 8:29 
GeneralRe: To bool or not to bool in C/C++ ? Pin
Richard MacCutchan21-Feb-20 22:03
mveRichard MacCutchan21-Feb-20 22:03 
GeneralRe: To bool or not to bool in C/C++ ? Pin
k505421-Feb-20 5:56
mvek505421-Feb-20 5:56 
GeneralRe: To bool or not to bool in C/C++ ? Pin
Richard MacCutchan21-Feb-20 6:07
mveRichard MacCutchan21-Feb-20 6:07 
GeneralRe: To bool or not to bool in C/C++ ? Pin
k505421-Feb-20 6:16
mvek505421-Feb-20 6:16 
GeneralRe: To bool or not to bool in C/C++ ? Pin
Richard MacCutchan21-Feb-20 6:18
mveRichard MacCutchan21-Feb-20 6:18 
GeneralRe: To bool or not to bool in C/C++ ? Pin
Vaclav_21-Feb-20 8:25
Vaclav_21-Feb-20 8:25 
GeneralRe: To bool or not to bool in C/C++ ? Pin
k505421-Feb-20 9:31
mvek505421-Feb-20 9:31 
AnswerRe: To bool or not to bool in C/C++ ? Pin
leon de boer21-Feb-20 11:55
leon de boer21-Feb-20 11:55 
GeneralRe: To bool or not to bool in C/C++ ? Pin
Vaclav_22-Feb-20 5:34
Vaclav_22-Feb-20 5:34 
GeneralRe: To bool or not to bool in C/C++ ? Pin
Richard MacCutchan22-Feb-20 6:47
mveRichard MacCutchan22-Feb-20 6:47 
GeneralRe: To bool or not to bool in C/C++ ? Pin
leon de boer23-Feb-20 5:29
leon de boer23-Feb-20 5:29 
GeneralRe: To bool or not to bool in C/C++ ? Pin
Richard MacCutchan23-Feb-20 6:08
mveRichard MacCutchan23-Feb-20 6:08 
GeneralRe: To bool or not to bool in C/C++ ? Pin
Victor Nijegorodov23-Feb-20 20:43
Victor Nijegorodov23-Feb-20 20:43 
GeneralText based mining game using if and while Pin
Chleba22519-Feb-20 10:41
Chleba22519-Feb-20 10:41 
GeneralRe: Text based mining game using if and while Pin
Stefan_Lang19-Feb-20 21:42
Stefan_Lang19-Feb-20 21:42 
GeneralRe: Text based mining game using if and while Pin
Vaclav_20-Feb-20 17:04
Vaclav_20-Feb-20 17:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.