Implicit int to enum [message #1796157] |
Sun, 07 October 2018 13:28 |
Eclipse User |
|
|
|
Hi,
I am building Unit Tests with Eclipse Luna as C projects. The files to be tested are compiled with a different embedded compiler. Eclipse uses the GCC C compiler.
I got the problem that the original files use implicit typecasts from integer to enum and I am looking for a way that Eclipse also use implicit typecasts. E.g. :
Code: [Select all] [Show/ hide]Rufus MapQuest UpToDate
typedef enum
{
e0 = 0U,
e1 = 1U,
e2 = 2U
} Enumtype;
void function(void)
{
int i=1;
Enumtype foo = i;
}
error I9167: argument of type "unsigned int" is incompatible with parameter of type "Enumtype"
The solution I found is:
Enumtype foo = (Enumtype) i;
However, this solution is unsatisfying in this case. I already checked the code analysis settings but I didn't found the option. Is there a way to enable these implicit casts?
[Updated on: Sun, 07 October 2018 19:38] by Moderator Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02611 seconds