From owner-cvs-all Thu Jan 3 2: 0:13 2002 Delivered-To: cvs-all@freebsd.org Received: from rwcrmhc52.attbi.com (rwcrmhc52.attbi.com [216.148.227.88]) by hub.freebsd.org (Postfix) with ESMTP id 7081537B419; Thu, 3 Jan 2002 02:00:09 -0800 (PST) Received: from InterJet.elischer.org ([12.232.206.8]) by rwcrmhc52.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020103100008.LEDI6450.rwcrmhc52.attbi.com@InterJet.elischer.org>; Thu, 3 Jan 2002 10:00:08 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id BAA22482; Thu, 3 Jan 2002 01:43:04 -0800 (PST) Date: Thu, 3 Jan 2002 01:43:02 -0800 (PST) From: Julian Elischer To: Matthew Dillon Cc: Poul-Henning Kamp , Stephen McKay , John Baldwin , cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, Julian Elischer , Greg Lehey Subject: Re: cvs commit: src/share/man/man3 queue.3 In-Reply-To: <200201030919.g039J8v63350@apollo.backplane.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 3 Jan 2002, Matthew Dillon wrote: > > > The issue here is to extend an abstraction up to the point where > the compiler can easily optimize it. Bugger the compiler, I want readable code.. :-) > > Most of the lists I use are implemented circularly internally, > allowing addhead, addtail, insertbefore, insertafter, and remove > functions to be implemented with no conditionals. In this case > the terminator is a pointer back to the list head. > > Now consider a MYLIST_EMPTY() macro verses a MYLIST_GETHEAD() > macro. MYLIST_GETHEAD() would have to check for the terminating > condition (a conditional) and return NULL if it's true and the head > node if it is false. MYLIST_EMPTY() simply checks the terminating > condition and returns a boolean. Now consider this code: I don't understand your point.. TAILQ_FIRST() does not do a conditional to give a NULL on empty.. ...#define TAILQ_FIRST(head) ((head)->tqh_first) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message