On Wed, 24 Dec 2008, Krzysztof Halasa wrote:Oh yes it can. People look at that, and it's so uncommon that they literally believe it is a mis-indent. Your example with nested if-statements are totally pointless, because you didn't even apparently understand my comment about "while()" having two totally different meanings (which is not true of "if()"), nor realize the importance of how common something is. Common patterns become things that people take for granted and don't have any trouble with. In contrast, do-while without braces is _extremely_ uncommon. Sorry, you're wrong. It's not changed to silence some tool. THIS IS THE KERNEL CODING STYLE. I don't care one whit about your personal coding style. The kernel has brances. End of discussion. sparse complains about lack of them. Comprende? I don't care. And I agree with you. "sizeof i" doesn't look good. It's uncommon, and doesn't match peoples expectations. I do to. And it's the common thing to do, and only totally confused people think that 'return' is a somehow remotely like a "function" of its arguments (the way 'sizeof' is - sizeof _is_ a function of its arguments, albeit a very rare one). No. "return x;" is clear because it's the common thing, which means that peopel are good at reading it. Another example of "common vs non-common" is this: if (0 <= x) do something.. is something that crazy people do (sadly, one of the crazy people taught the git maintainer C programming, so now even sane people do it). It's crazy because it's uncommon, which means that most people have to think about it A LOT MORE than about if (x >= 0) do something.. even though technically both are obviously EXACTLY THE SAME THING. Can you see the argument? Doing things the common way is important, because it allows people to see what they mean without having to think about it. They just scan it, and the meaning is clear. And that's why "do while" without braces is bad. If you scan it quickly on its own, you may well end up just seeing the while (x); part, and get confused ("oh, a delay loop"). But if you see } while (x); you aren't confused, because the latter one is clearly an ending condition of a do-while loop, IN A WAY THAT THE FIRST ONE IS NOT! See? do-while is very special, because as mentioned, "while" is a really magic C keyword that has two TOTALLY DIFFERENT meanings. Don't make people look for the "do". Linus -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| David Newall | Re: Slow DOWN, please!!! |
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
| Fernando Luis | [PATCH] affinity is not defined in non-smp kernels - x86_64 |
git: | |
| David Miller | [GIT]: Networking |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 28/37] dccp: Integration of dynamic feature activation - part 3 (client side) |
| Jean-Louis Dupond | tg3 driver not advertising 1000mbit |
