You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Requesting input from C++ experts regarding a puzzling behavior of the DateTime class as defined in this DS3231.h.
In Arduino IDE 1.8.15, at least, the following assignment ("=" operator) compiled and executed without error or any warning related to type mismatch between the LH and RH operands.
#include <DS3231.h>
DateTime myDT;
uint32_t arbitraryInteger = 42;
void setup() {
myDT = arbitraryInteger;
// ...moreover, to make it perfectly clear...
myDT = 42;
}
Meaningless date and time values wwere retrieved from the DateTime instance following such an assignment.
Code writers using this library should exercise care to ensure that only sensible values are assigned to a DateTime instance.
My question for the community is whether -- and how -- the DateTime class can be defined in such a way that the Arduino IDE compiler will reject assignments of values, to a DateTime instance, that are of other, different, incompatible data types.
The text was updated successfully, but these errors were encountered:
Requesting input from C++ experts regarding a puzzling behavior of the DateTime class as defined in this DS3231.h.
In Arduino IDE 1.8.15, at least, the following assignment ("=" operator) compiled and executed without error or any warning related to type mismatch between the LH and RH operands.
Meaningless date and time values wwere retrieved from the DateTime instance following such an assignment.
Code writers using this library should exercise care to ensure that only sensible values are assigned to a DateTime instance.
My question for the community is whether -- and how -- the DateTime class can be defined in such a way that the Arduino IDE compiler will reject assignments of values, to a DateTime instance, that are of other, different, incompatible data types.
The text was updated successfully, but these errors were encountered: