<sys/queue.h> bikeshed proposal

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Mar 15 22:16:50 UTC 2007


In message <20070315134300.GE28354 at comp.chem.msu.su>, Yar Tikhiy writes:

>Yeah, <sys/queue.h> can present a challenge in understanding an
>implementation of basic data structures and related algos. :-)
>You thought that tqe_prev points to the whole entry structure when
>making the patch, didn't you?

Nah, I was just generally sleepy I think.

>Personally, I cannot explain to myself why in the double-linked
>structs the prev member points to the next member in the previous
>list element and not to the previous list element itself.  Could
>anybody with CS education explain merits of the current approach?

It allows us to isolate casts to those few backwards functions,
all the forwards functions are type correct.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-arch mailing list