Best coding practice.

Jantje:

WizenedEE:
bool, true, and false are all part of C++, but not part of C, [citation needed]

I think the text I quoted states that: "bool, true, and false are all part of C++" and "boolean, true, and false are all part of C (since C99)"

Interesting. C99 is, unfortunately, still not used all that frequently, which makes me not really think of it as C (although I'm not blaming anyone for doing so; it is indeed C)

WizenedEE:
It's just that you said the arduino files defined them, which is not true.

Can you please quote my statement that makes you think I said so?

in arduino, bool maps to _Bool which is a native GCC type (but I'm not sure what it translates to)"

WizenedEE:
boolean is completely different and I don't see why anyone would ever use it.

Wikipedia states "C++ has a separate Boolean data type ('bool'), but with automatic conversions from scalar and pointer values that are very similar to those of C."
You state "completely different" wikipedia states "very similar". Please take up your concerns with wikipedia so we all can learn?

wikipedia is talking about bool' not boolean.' Also, even if wikipedia was talking about `bool' it says ``very similar'' in respect to a different topic --- C vs C++, not bool vs int. Context is always relevant.

Wikipedia states "One problem with this approach is that the tests if(t==TRUE){...} and if(t) are not equivalent."
Which I think is a really good reason not to use bool.

They're the same if t' is a bool (assuming the capitalization issue is fixed). They may not be the same if t' is something else (like an int), which I think is a really good reason to use bool.


I'm not trying to be antagonistic; I just like correct things. And discussion.