c 警告[Pe188]:枚举类型与另一种类型混合

c Warning[Pe188]: enumerated type mixed with another type

我收到警告:

Warning[Pe188]: enumerated type mixed with another type

在:

ErrorFlag = (CurrentTime - TimerX > TIMEOUT_X);

但如果我将其替换为:

,警告就会消失
if(CurrentTime - TimerX > TIMEOUT_X)
{
  ErrorFlag = TRUE;
}

第一种设置方法有什么问题ErrorFlag

编辑:

我有一个本地 enum:

typedef enum{
   FALSE = 0;
   TRUE= 1;
}BOOL;

ErrorFlag 是类型 BOOL

根据 C11,章节 §6.5.8(强调我的

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 type int.

可能TRUE 的类型不同,这似乎是您的代码本地的 enum 值。