Can't understand why I have this warning comparison of unsigned expression < 0 is always false
Posted: Thu Dec 15, 2022 12:01 pm
Hi, I can't understand why I have this kind of warning:
warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
The operation is:
where variable and definitions are:
Seems that the result of the operation is considered as unsigned despite the presence of a signed variabile in it.
What am I missing?
warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
The operation is:
Code: Select all
if ( SUBSCRIPTION_EXPIRY_TIME - ((hwRtc - lastSub)*1000) < 0 )
Code: Select all
#define SUBSCRIPTION_EXPIRY_TIME (5*60*1000)
time_t hwRtc
uint32_t lastSub
What am I missing?