3 ms·
Apparently things-that-shouldn't-happen happen 10x more in C code than the next nearest language.
by ZeroGravitas 11y ago
Apparently things-that-shouldn't-happen happen 10x more in C code than the next nearest language.
- BinaryIdiot 11y agoI didn't even notice that. Good observation. I wonder if that's simply because C is a lot older and may just have a lot more dead code or this type of code or something else entirely.
- nxzero 11y agoMaybe it's because C coders want to know why something happens more than coders in other popular languages; say popular since the frequency of an occurrence is proportional to the volume of source code in a given language.
- speeder 11y agoI am a C lover. It is because C has no exception handling, and C coders still want to be sure. For example once I had a game where I ended putting a couple "should never happen" in my code related to some OS stuff, and... the "should never happen" happened once, after figuring how to reproduce it, it was a driver bug (or something like that, happened years ago, I don't remember the details anymore, only remember that it went away after I switched from Alsa to OSS4 on my Linux box). EDIT: should never happen is good against compiler bugs too, I've seen my fair share of them.
- nothrabannosir 11y agoLooking at the C results, it seems all of them are from the same file (socket.h) copied to different repositories.
- odabaxok 11y agoI thought the same, then I searched for "This cygwin SIOCGIFCONF should never happen" and it finds only 319. To me it seems like the search is grouping similar results in some way.
- groundCode 11y agoor C developers have considered things that should not happen more than the next nearest language.
- notacoward 11y agoTotally THIS. Many C coding standards require that every return value be checked, every "switch" statement have a default case, etc. Programmers comply, but sometimes the conditions they're checking truly are impossible, so you end up with messages like these. By contrast, coding standards for languages with exceptions typically do not require such constant checking in the code. An uncaught exception is the moral equivalent of "this should never happen" but doesn't show up in a search like this. Without even getting into the issue of whether C programmers are really more diligent than Java or Python programmers (for example) there's a measurement problem to contend with here.