include/list.h
Tiago Vignatti
tiago.vignatti at nokia.com
Fri Jun 11 06:49:17 PDT 2010
On Fri, Jun 11, 2010 at 08:41:44AM +0200, ext Peter Hutterer wrote:
> On Thu, Jun 10, 2010 at 11:04:20PM -0700, Keith Packard wrote:
> > On Fri, 11 Jun 2010 15:24:47 +1000, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> >
> > > isn't the whole point of the list macros that we don't have dozens of
> > > different list implementations, all with their own bugs?
> > > you're just moving the problem, not fixing it.
> >
> > For a singly linked list which is only freed once, I'd have to say that
> > the benefit of using the list macros is pretty weak. I must be old
> > fashioned, but I find an open coded singly-linked list far easier to
> > read than the list macros we've got.
>
> I don't like them (yet) because I can read open coded lists better than the
> macros. Though I haven't looked at the macros much yet but the preprocessor
> output is scary. what matters long-term though is that the list macros are
> supposed to be reliable and consistent, avoiding all the bugs of forgetting
> to update the next pointer, etc.
> The point is, I shouldn't have to look at a list implementation ever again
> when triaging bugs (other than checking the parameters).
>
> > Plus, the list macros aren't even
> > type safe, and the appear to encourage type-unsafe coding styles.
>
> Can the macros be made type-safe then?
I don't think there's a way to do so. The easiest way here would be to
transform those macros in inline functions.
Cheers,
Tiago
More information about the xorg-devel
mailing list