after googling for a while I found out that bool and boolean can be used interchangeably in the Arduino IDE. Is that correct?
Pretty much.
I personally prefer bool, because it is standard C language style. What do you think?
I prefer
bool.
And if it is correct, why do I get a 14 bytes larger program when compiling the following code:
Serial.println(heatingStatus);
heatingStatus is extended to 16 bits (one machine instruction) when
heatingStatus is
bool (different
println is called).
Serial.println(mixerStatus);
Ditto. Repeat for the remaining prints.
Another strange thing: whether or not I declare the function at line 35 as bool or boolean I always get the same compiled size.
What is wrong with the compiler?
First, even though it does work, returning 1/0 is not correct. A
bool is either
true or
false.
You get the same size code because
bool and
boolean are both one byte and 1/0 is essentially interchangeable with
true/
false.