3 ms·
The problem isn't leaving out the 'default' case. The problem is coding it as default: return DROP_CONNNECTION_AND_BAIL;
by caf 8y ago
The problem isn't leaving out the 'default' case. The problem is coding it as
default:
return DROP_CONNNECTION_AND_BAIL;
- pdkl95 8y agoYes, which is why I really like the idea of proactive enforcement with random expected-to-be-ignored tags/parameters. I'm arguing against the idea that leaving out the last part of this for (item = params->head; item; item = item->next) { switch (item->type) { case KNOWN_PARAM_TYPE_FOO: // do normal stuff break; /* ... etc ... */ IGNORE_KNOWN_PARAM_TYPE_BAR: // fallthrough - BAR explicitly uses default handling default: continue; // skip unknown parameters } } is evidence of incompetence, not a strategy that will "make more profit than your competitor". Also, as the BAR constant suggests, you probably already have code that skips unrelated fields. While the difference in programmer time is almost always trivially small, sometimes it might be zero.
- mathw 8y agoUnfortunately incompetence can sometimes lead to increased profits in the short term. Why else is there so much horrendous software out there?