SRC\file.c:776: warning: [#188-D] enumerated type mixed with another type Reason: You are trying to use one enumerated type, where another one should be used according to declaration. Most likely you are calling the function with the parameter name from one enum type. However in the function declaration another enum type is stated for this parameter. Example: /* Type definitions */ typedef enum { APPLE, ORANGE, NUMBER_OF_FRUITS }fruitType; typedef enum { TOMATO, CUCUMBER, NUMBER_OF_VEGS } vegType; /* Function prototype definitions */ void func(fruitType param1, vegType param2); /* Prototype of func with param1 of "fruitType" type */ void main(void) { vegType vegetable; fruitType fruit; vegetable = TOMATO; fruit = ORANGE; func(vegetable, fruit); /* Call to func with param1 of "vegType" type */ } Problem: The dangers of enum types is that you reference them as names in the code, but compiler would exchange them with uint type numbers starting from 0. When debugging you will expect the values of "int", which you actually find, even if you mistakenly used another enum. This mistake commonly takes place, when several consecutive enums are used as parameters during certain function call.
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
AuthorWarnings are important! Archives
May 2017
Categories |