Ævar Arnfjörð Bjarmason [off-list ref] writes:
I think listing the remaining enum arms is a small price to pay for
having that all moved to compile-time.
I can sympathize with that point of view, since I used to think the
same way, but I am not yet convinced. An example like this from
your postimage, which doubles the size of a switch statement with
empty case arms, demonstrates that it is not a "small" price.
Admittedly, the original switch statement is particularly bad,
though ;-)
switch (opts->type) {
case OPTION_STRING:
case OPTION_FILENAME:
case OPTION_INTEGER:
case OPTION_MAGNITUDE:
case OPTION_CALLBACK:
case OPTION_BIT:
case OPTION_NEGBIT:
case OPTION_COUNTUP:
case OPTION_SET_INT:
has_unset_form = 1;
break;
- default:
+ /* special types */
+ case OPTION_END:
+ case OPTION_GROUP:
+ case OPTION_NUMBER:
+ case OPTION_ALIAS:
+ /* options with no arguments */
+ case OPTION_BITOP:
+ /* options with arguments (usually) */
+ case OPTION_LOWLEVEL_CALLBACK:
break;
}