Messages in this thread | | | From | Herbert Xu <> | Subject | Re: [PATCH] hlist_for_each_safe cleanup | Date | Sun, 25 Jul 2004 19:32:27 +1000 |
| |
Stephen Hemminger <shemminger@osdl.org> wrote: > On Fri, 23 Jul 2004 23:22:23 +0200 > >> What's wrong with using the comma operator instead of non-standard >> statement expressions? > > It was more a case of consistency and avoiding the n = NULL assignment when pos > is NULL. > > Look at hlist_for_each_entry_safe > > #define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ > for (pos = (head)->first; \ > pos && ({ n = pos->next; 1; }) && \ > ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ > pos = n) > > What's your problem with the gcc extensions, the kernel uses them all over the place, > planning on starting a conversion?
Yes but a comma operator will achieve exactly the same thing and is more concise:
pos && (n = pos->next, 1) &&
You could also write
pos && ((n = pos->next) || 1) &&
Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |