Date: Tue, 08 May 2007 11:45:02 -0700 From: Julian Elischer <julian@elischer.org> To: John Baldwin <jhb@freebsd.org> Cc: Hans Petter Selasky <hselasky@c2i.net>, Giorgos Keramidas <keramida@freebsd.org>, freebsd-arch@freebsd.org Subject: Re: Missing LIST_PREV() ? Message-ID: <4640C52E.7010209@elischer.org> In-Reply-To: <200705081128.25708.jhb@freebsd.org> References: <200705051617.34162.hselasky@c2i.net> <20070507202034.GA80846@kobe.laptop> <20070507202517.GA88340@kobe.laptop> <200705081128.25708.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin wrote: > On Monday 07 May 2007 04:25:18 pm Giorgos Keramidas wrote: >> with other compilers. > > This can be fixed by passing the type as an argument which is what > TAILQ_PREV() does: > > #define TAILQ_PREV(elm, headname, field) \ > (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) > > I'm not sure how portable offsetof() would be though. In general if you want > this feature, you should just use a TAILQ though. TAILQ_ENTRY() is the same > size as a LIST_ENTRY(), it just adds one more pointer to the HEAD structure. > It is also specifically designed to make TAILQ_PREV() work w/o needing the > offsetof() hack. > I agree with this.. that's why we have the different types. The suggested change in ingenious but I don't know how portable it is..
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4640C52E.7010209>