3 ms·
Among some valid criticism, the author complains a lot about trivial things. He also thinks that assignment inside the comparison part of a for loop is 'weird'.
by cygx 12y ago
Among some valid criticism, the author complains a lot about trivial things. He also thinks that assignment inside the comparison part of a for loop is 'weird'.
Sure, it could and perhaps even should be avoided in this particular case, but in general it's a useful and common C idiom. Compiler writers are aware of that and avoid issuing warnings if you parenthesize the offending assignment expression.
He also compares pointer values against NULL. If I were as uncharitable as he has been, I'd argue that this shows a 'shocking' lack of knowledge about how C works. In C, comparing against NULL is as 'bad' as comparing boolean expressions against true and false in other languages.
edited: be less cranky
- chris_wot 12y agoCompiler writers are aware of that and avoid issuing warnings if you parenthesize the offending assignment expression. I see no parentheses in that code.
- cygx 12y agoWhich would have been a valid complaint.
- chris_wot 12y agoOut of interest, where exactly is the source code history for bash?
- cygx 12y agoThere's https://ftp.gnu.org/gnu/bash/ https://ftp.gnu.org/gnu/bash/ starting with 1.14.7 and containing diffs back to 1.14.0. There's also a corresponding git repository, also starting at 1.14.7: http://git.savannah.gnu.org/cgit/bash.git/log/?ofs=50 http://git.savannah.gnu.org/cgit/bash.git/log/?ofs=50 No idea about earlier revisions.
- deleted 12y ago[deleted]