Given an enum like:
enum Colours { RED, YELLOW, BLUE, NUM_COLOURS };
And some logic like:
switch (colour) {
case RED: /* ... */ break;
case YELLOW: /* ... */ break;
case BLUE: /* ... */ break;
}
Most compilers with reasonable settings are going to protest that NUM_COLOURS
is an unhandled case. However, that's obviously not how that particular value is meant to be used, and a case statement for it would be nonsense.
Is there any way to let the linter/compiler know that ignoring that specific value is correct and proper? Or a way of determining that value without including it in the enum?