Everywhere I look, it says zero is false and any other value is true. But I'm asking the opposite question. I assume the numerical value of false is zero, but what is the numerical value of true? If it's one, is it always one?
I want to set the alarm time on an RTC to the next multiple of five seconds, but at least one full second from now. So if it's currently 4 seconds, I want to set the alarm to 10 seconds, not 5.
byte r = Sec % 5; // alarm seconds multiple of 5
Seconds = Sec +5 -r + (r==4)*5; // at least one second from now
That seems to work. But will any comparison that evaluates as true equal one? Always? (In C++ at least.)
Some definitions can not be changed in C++. Or would you like to check each new C/C++ version for eventual changes in the conditional values or other breaking news?