by kbart · 10y ago · 0 comments
There's also the case of short little utilities. For something like strncmp (or at least my slightly naive version), I'd rather see code like
int strncmp(const char* s1, const char* s2, int n)
{
for(; n>0; s1++, s2++, n--) {
if (*s1 < *s2) {
return -1;
} else if (*s1 > *s2) {
return 1;
}
}
return 0;
}
than have code where someone attempted to come up with long "meaningful" names for each variable. There isn't really meaning here beyond "pointer_to_string1" and "pointer_to_string2", and longer names here do nothing but add visual clutter.The timer on the page put me under more stress than I'd like to admit. Maybe this is quite a good simulation of code review reality though, where you try cover lots of code in a small amount of time.
The Plan9 community has to defend no highlights to n00bs.