I have an enum:
enum myenum{
typeA,
typeB,
typeC
} myenum_t;
Then, a functions is to be called with an enum parameter:
A common convention for this is to do something like this:
typedef enum {
typeA,
typeB,
typeC,
num_types
} myenum_t;
Then you can check for (t < num_types).
If you subsequently add more enums, e.g.
typedef enum {
typeA,
typeB,
typeC,
typeD,
typeE,
num_types
} myenum_t;
then num_types is automatically updated and your error checking code doesn't need to change.