3 ms·
Boohoo. I mean it. I don't think they even make compilers that don't warn about the top 2 issues, and 5 for sure. And after that it gets down to "I did somet
by tedunangst 16y ago
Boohoo. I mean it.
I don't think they even make compilers that don't warn about the top 2 issues, and 5 for sure. And after that it gets down to "I did something stupid and something stupid happened." I mean:
int ii = i/++i;
Seriously? As if defining the order of operations would magically take the suck out of that statement.
There are like 1.5 nuggets of real pain in here. (1 point for returning a stack array, 0.5 points for noticing that C is C.)
- psyklic 16y agoAgreed. Most of these are beginner traps, raise compiler warnings, are very obscure, and/or are simple to avoid if simple conventions are followed.
- __david__ 16y agoYeah, I was quite underwhelmed by these complaints. Several I don't even think are correct: #9: #define DEVICE_COUNT 4 uint8 *szDevNames[DEVICE_COUNT] = { "SelectSet 5000", "SelectSet 7000"}; /* table has two entries of junk */ "junk" is incorrect. It has 2 entries of zeros, and that is something that you can count on. If you really don't like that (and I generally do like that) you can turn on gcc's -Wextra which will warn about it. #17 complains about char's being signed but really it should be complaining about chars' signedness not being spec-ed (really--it's implementation dependent whether plain "char" is signed or unsigned. If you really care, use the "signed" keyword. But really, complaining about overflow? Strange.
- alexgartrell 16y agoI think the problem is that a lot of languages encourage you to do something clever, whereas C actively and relentlessly punishes you for being clever. My favorite example is from #19, which is something that javascript programmers do all of the time. int value = a && b && fn(a->x,b->x); (The author goes on to complain about how value you obviously be whatever fn(a->x, b->x) returns). In javascript, that's actually good practice (I guess, I had a mentor once who encouraged it, but I never really bought into it). To a C programmer though, that just looks gross. (Or at least to me, and I like to pretend to be a C programmer).
- alexgartrell 16y ago(the author goes on to complain about how the value ought to be whatever fn(a->x,b->x) returns)* That was bad.
- tedunangst 16y agoFunny that you mention it. JavaScript "the bad parts" is a serious contender in the bad language arena.