3 ms·
from the patch I see, isn't the problem that C doesn't enforce a default case?
by mikerichards 11y ago
from the patch I see, isn't the problem that C doesn't enforce a default case?
- danieltillett 11y agoThe problem is not that there is not an enforced default case, but that it was not in the coding standards. I always have a default case, but this is in my coding standards.
- mirashii 11y agoNeither of these things actually fix the problem, which is in particular the content of the default case. default: ; break; would be just as buggy.
- gpvos 11y agoThe commit message says the code was reviewed quite thoroughly. So I think a break-only default case where the other two cases had an /* implied MB */ comment would likely have been noticed. So in this particular case, there is a fair chance that such a warning would have helped.
- cremno 11y agoGCC has a diagnostic for that (-Wswitch-default) but see mirashii's comment.
- asveikau 11y agoWas waiting for an HN user to come forward and say that a processor specific synchronization primitive bug is C's fault... Hilarious. Much more important what the code in that new default block is doing. It's a memory fence.