Can't understand why I have this warning comparison of unsigned expression < 0 is always false

lodogg
Posts: 7
Joined: Wed Sep 11, 2019 11:06 am

Can't understand why I have this warning comparison of unsigned expression < 0 is always false

Postby lodogg » 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:

Code: Select all

         if ( SUBSCRIPTION_EXPIRY_TIME - ((hwRtc - lastSub)*1000) < 0 )
where variable and definitions are:

Code: Select all

#define SUBSCRIPTION_EXPIRY_TIME    (5*60*1000)
time_t hwRtc
uint32_t lastSub
Seems that the result of the operation is considered as unsigned despite the presence of a signed variabile in it.
What am I missing?

Who is online

Users browsing this forum: No registered users and 105 guests