Showing posts with label Enumeration value not handled in switch. Show all posts
Showing posts with label Enumeration value not handled in switch. Show all posts

Wednesday, 21 November 2012

Enumeration value not handled in switch


I get the error Enumeration value 'Blue' not handled in switch below the code.

I'm having a enumeration of colors with 3 color.
UIColor color {Red, Green, Blue};
switch (color){
case Red:
break;
case Green:
break;
}


GCC compiler -> generates warning on this code.
LLVM compiler -> generates error on this code.

You have to check all the enumeration values.
switch (color){
case Red:
break;
case Green:
break;
case Blue:
break;
}