Hi, all. I'm compiling with gcc -Wall -Wextra. My functions return an enumeration to the caller, and then the caller deals with it like this:
Now, my switch statements do not handle all possible values within the enumeration, because I know that it is (or should be) impossible for certain values to be returned in certain circumstances. GCC gives me:Code:switch (result) { case success: /*blah*/ case failure: /*blah*/ case another: /*blah*/ }
warning: enumeration value 'another' not handled in switch
warning: control reaches end of non-void function
Now whatever code GCC is generating for the other values of the switch, I know it can never be executed. What's the 'proper' way of dealing with this?
Richard (TIA)



1Likes
LinkBack URL
About LinkBacks


