Linus Torvalds <torvalds@linux-foundation.org> writes:People learn, or should, through the life :-) I'm not sure being common or less common does matter here much. OTOH I think it's pretty common. Approx as common as while (x) y is, isn't it? Except in macros: do-while(0) is commonly used in macros because it "eats" the semicolon. (do { xxx; yyy; zzz } while (0) is also quite common instead of "goto" to add multiple exits from a long block). Only apparently. If there is no ambiguity, there is no problem, the double meaning does not seem relevant. You tell me that do expr; while (condition); (with precisely this formatting) can be unclear? Or you say do { expr; } while (condition); is better? If it is, then certainly not for me. Now: are we going to write {} because you say so, even if it makes the code worse? Or should we rather aim at improving the code, even if only a bit? (I admit that, IMO, the second example is worse = less readable, but only a small bit). Come on, you have it plain in the subject - "fix sparse warnings". If it was "improve obscure notation" I wouldn't say a word. But it doesn't matter if it's common or not. It doesn't look good and THIS IS WHY it's uncommon/nonexistent. Not the other way around. There are many uncommon things in a project like a Linux kernel. There are some macros which take me a while :-) to understand and they thankfully don't spew warnings. No. It's crazy not because it's uncommon, but because this is how we have been taught in school. I don't know reasons for "0 >= x" but I know one for if (0 == x) do something.. It's because people sometimes write "=" instead of "==" and "0 = x" doesn't make sense to gcc. I think it's not a valid reason, and (unless you use (()) which is IMHO also crazy) gcc will warn about if (x = 0) (though I think the warning is stupid and "if (a = b)" is a valid usage if a and b are short). It's simple: one has to see the difference between if (x = 0) vs if (x == 0), there is no way around it. if (0 >= x), I don't know. Then I must be different. Things are clear to me if they are clear, even if they are uncommon. And common things aren't necessarily clear. Hmm, I should have expected something like that. Nope. It raises a red flag in my head immediately. We don't do such busy loops generally, and if we do, I would write it as: while (x) ; No. I must be different. Probably. I just don't see it. For me, every code fragment is different, and a program like sparse can't even come close to know what's clear for me and what is not. I use sparse as a great help - but only that, a help. -- Krzysztof Halasa -- 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
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Martin Michlmayr | Network slowdown due to CFS |
| Ingo Molnar | Re: x86 arch updates also broke s390 |
git: | |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
| David Miller | [GIT]: Networking |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Natalie Protasevich | [BUG] New Kernel Bugs |
