Reputation: 483
I got the warning:
Warning[Pe188]: enumerated type mixed with another type
at:
ErrorFlag = (CurrentTime - TimerX > TIMEOUT_X);
but the warning is gone if I replace it with:
if(CurrentTime - TimerX > TIMEOUT_X)
{
ErrorFlag = TRUE;
}
Whats wrong with the first method to set ErrorFlag
?
Edit:
I have a local enum
:
typedef enum{
FALSE = 0;
TRUE= 1;
}BOOL;
and ErrorFlag
is of type BOOL
.
Upvotes: 0
Views: 5286
Reputation: 134356
According to C11
, chapter §6.5.8 (emphasis mine)
Each of the operators
<
(less than),>
(greater than),<=
(less than or equal to), and>=
(greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is false.107) The result has typeint
.
Which may not be the same type as TRUE
, which seems to be an enum
value local to your code.
Upvotes: 2