Comment by nawgz
5 years ago
I mean, this can happen with any code by that logic if you're cut and pasting.
I think the real issue is types aren't included in the example. I work in much higher-level languages, but if you are passing strongly typed objects thru and your switch is derived on this typing, it's probably going to be illegal in your type system to return certain results.
If your type system doesn't validate your results, then you'll be prone to the class of error you are discussing. Maybe that's common in C.
No comments yet
Contribute on Hacker News ↗