OK, this seems like a simple thing, but I can't explain it. I have a program than is checking for daylight savings time. It determines the month and day, then compares it to the start (and end) of daylight savings time. To boil it down to something simple, if I do:
int mmdd = 306;
Serial.println(mmdd >= 0314);
The result is 1 - which it shouldn't be. 306 is less than 314.
If I do
int mmdd = 306;
Serial.println(mmdd >= 314);
The result is 0 - as expected.
Why is 0314 different than 314? I was originally using 0314 just to kind of document March 14th. I have fixed the code, but want to understand what the compiler is doing. It is a leading zero, not the letter O (which would have generated a compile error anyway).
Never would have guessed that. I would have thought that octal numbers would be entered as something like 0o1234 similar to 0xABCD for hex. But I get it.
I haven't worked with octal numbers in almost 50 years.