gcc - Enum within structure : comparison between '' and 'enum <anonymous> -


typedef enum

{      var1,var2  }enum1;   typedef enum   {    var3,var4 = 8  }enum2;  struct struct1  {    enum1 e1;    enum2 e2;  };  int main()  {    struct struct1 *s1;     if (s1 -> e1 == var4) 

this code throws warning :

comparison between 'enum1' , 'enum ' [-wenum-compare].

though after reading set 1 enum equal another, , changing code

s1 -> e1 ==(enum1) (int)var4

i m unable resolve.

some suggestions clear warning of great :)

can converting both var int type works? or use -wno-enum-compare compiler option


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -