[PATCH vkd3d 2/5] include: Avoid using a field reference as a truth value.

Henri Verbeet hverbeet at gmail.com
Tue Jan 11 09:02:27 CST 2022


On Tue, 11 Jan 2022 at 00:06, Zebediah Figura (she/her)
<zfigura at codeweavers.com> wrote:
> On 1/6/22 03:33, Henri Verbeet wrote:
> > On Fri, 17 Dec 2021 at 19:05, Zebediah Figura <zfigura at codeweavers.com> wrote:
> >>
> >> Ported from 5d01ebab89cee8a3499ee00729c048068d5b719d from Wine.
> >>
> >> Despite the commit message there, even GCC 11.1 chokes on this.
> >>
> > For what it's worth, there's a single usage of RB_FOR_EACH_ENTRY in
> > vkd3d, and it looks like something that doesn't particularly need it.
> > We have generally preferred using rb_for_each_entry(), so we could
> > also just get rid of these macros.
>
> Is there a reason to prefer rb_for_each_entry()? It has always struck me
> as clumsier to program with callbacks, although I guess that's a matter
> of personal taste.

Yes, mostly a combination of style preferences and a general dislike
of macros. (E.g., note that these macros, like many others, aren't
safe from evaluating arguments multiple times.) Even when doing loop
style iteration though, note that we could just use rb_head() and
rb_next(), without necessarily needing these macros.



More information about the wine-devel mailing list