On Thu, 2006-11-16 at 18:25 -0500, John W. Linville wrote: > On Fri, Nov 17, 2006 at 12:04:29AM +0100, Johannes Berg wrote: > > Remove things like "for (;;)" or "for (; condition ;)". > > Ever heard of while loops? > > > --- wireless-dev.orig/net/d80211/sta_info.c 2006-11-16 23:40:48.164935990 > > +0100 > > +++ wireless-dev/net/d80211/sta_info.c 2006-11-16 23:55:34.634935990 > > +0100 > > @@ -299,7 +299,7 @@ static void sta_info_cleanup_expire_buff > > if (skb_queue_empty(&sta->ps_tx_buf)) > > return; > > > > - for (;;) { > > + while (1) { > > spin_lock_irqsave(&sta->ps_tx_buf.lock, flags); > > skb = skb_peek(&sta->ps_tx_buf); > > if (sta_info_buffer_expired(local, sta, skb)) { > > FWIW, I think I prefer the "for (;;)" version for endless loops. > It looks more intentional to me. Some grep'ing showed nearly equal > usage of "for (;;)" versus "while (1)". Is there any "official" > preference? I don't see anything in CodingStyle about it.
I don't know about official preference, but in ages past, using "for(;;)" was preferable because "while(1)" would often invoke a "statement has no effect" warning from the compiler. gcc 4.0.2 doesn't have this problem, but IIRC it used to. FWIW, I prefer "for(;;)" because of painful memories with other people's code and -Werror, but I don't barf at "while(1)". - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html