3 ms·
Is this trolling? Maximum of 5 global variables? For loop syntax? "objective" measures of code quality? This kind of code shows up in any legacy code base, an
by oppositelock 12y ago
Is this trolling?
Maximum of 5 global variables?
For loop syntax?
"objective" measures of code quality?
This kind of code shows up in any legacy code base, and style isn't what leads to bad code. Bash had a parser bug, a bug which anyone could have introduced irrespective of style.
- geon 12y agoThe only mention of shellshock "starting with the function that is at the heart of the #shellshock bug", is also the only connection to it. I suppose the objective measures he refers to are the static analysis he mentions in the next paragraph. It is hardly a controversial that global state is bad, and that code should be clear rather than clever.
- cygx 12y agocode should be clear rather than clever But clarity depends on context. Personally, in context of the C language, I find code like while ((string = *env++)) (which is how the offending loop could have been written as well) perfectly clear. I doubt someone coming from a, say, Java-background would agree. Similarly, he complains that the loop index was called string_index instead of the 'far superior' i. With C99, I'd agree. But in a C90 codebase, do you really want to have declarations like int i,j; instead of int char_index, string_index; at the top of a block?