3 ms·
As much as I think the fact that assignment in C returns the value causes barbaric illegible code, c programmers seem to love it (similar uses of increment squi
by Pxtl 12y ago
As much as I think the fact that assignment in C returns the value causes barbaric illegible code, c programmers seem to love it (similar uses of increment squick me just as much - return a value or change state, not both). Like it or not it's a popular feature so it's silly to argue that the loop isnt idiomatic. The plethora of globals is more worrying to me.
The loop construct shows a coder who is obsessed with terse code, but knows their crap. The globals show somebody who doesn't care about sensibly organized code.
- cygx 12y agoAs much as I think the fact that assignment in C returns the value causes barbaric illegible code, c programmers seem to love it C doesn't have all the nice sugar that comes with newer or more high-level languages. Sure, it would look nicer if we were able to write things like for (char cc : stdin.chars) { ... } for (string : iterator(env)) { ... } But that's not an option, so we make do with what's available: for (int cc; (cc = getchar()) != EOF; ) { ... } while ((string = *env++)) { ... } Assignment expressions are crucial for that.
- readerrrr 12y agoFor me, one of the advantages of C is that it lacks syntactic sugar. Writing a couple of extra characters is an acceptable tradeoff. Keeping it as simple as possible, with as few operators and keywords, is better.