双重枚举演员警告类型混合

Tob*_*oby 0 c enums casting compiler-warnings

我有以下C行代码,其中cfType是一个普通的C enum类型:

int foo (double * parameters) {
...
cfType coefSelect = (cfType) *parameters; /* The double pointed by at parameters
                                           * is cast to a cfType enum and result
                                           * is put in the var coefSelect.
                                           */
...
}
Run Code Online (Sandbox Code Playgroud)

但是编译器在强制转换时给出了"枚举类型与另一种类型混合"的警告 - 但是演员不应该阻止此警告吗?

我在代码编辑工作室中使用德州仪器的C2000 C编译器

Kev*_*ARD 6

我认为你必须先投入一个整体类型来防止这个警告.

就像是:

cfType coefSelect = (cfType)(int) *parameters;
Run Code Online (Sandbox Code Playgroud)