Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Jan 2002 18:08:37 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Julian Elischer <julian@elischer.org>, Matthew Dillon <dillon@apollo.backplane.com>
Cc:        Poul-Henning Kamp <phk@critter.freebsd.dk>, Stephen McKay <mckay@thehub.com.au>, John Baldwin <jhb@FreeBSD.org>, cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Greg Lehey <grog@FreeBSD.org>
Subject:   Re: cvs commit: src/share/man/man3 queue.3
Message-ID:  <p05101006b85a9329f10b@[128.113.24.47]>
In-Reply-To: <p05101005b85a8a34d794@[128.113.24.47]>
References:   <Pine.BSF.4.21.0201031358340.24204-100000@InterJet.elischer.org> <p05101005b85a8a34d794@[128.113.24.47]>

next in thread | previous in thread | raw e-mail | index | archive | help
At 5:53 PM -0500 1/3/02, Garance A Drosihn wrote:
>At 2:00 PM -0800 1/3/02, Julian Elischer wrote:
>>We are arguing about TAILQ_FOREACH not CIRCLEQ_FOREACH (Which phk
>>deleted anyhow)
>
>Perhaps another way to address this is to provide another set of
>BLAHQ_* macros, which would do exactly what you want (with the absolute
>optimal performance characteristics for TAILQ), but write one for each
>kind of queue.  That way, people could change TAILQ_DIDNT_DO_EACH() to
>COOLERQ_DIDNT_DO_EACH(), and if there was no such macro then they'd have
>a very large flag telling them to look closer at that section of code.
>The problem with your suggestion, as it stands right now, is that you
>are writing code which is specific to one kind of queue, but you are
>not "hiding" that in a BLAHQ_* macro.  While this solution would work
>for me, I'll admit that I haven't the slightest idea of a good name for
>that macro...

Consider, for instance, the TAILQ_FOREACH_REVERSE() macro.  It only
exists for TAILQ.  If I change from a TAILQ to an STAILQ, I will get a
compile-time error because there is no STAILQ_FOREACH_REVERSE() macro.
If developers have used the queue.h macros correctly, then someone can
"almost blindly" change from a TAILQ to an STAILQ, and they don't have
to look at every loop in the code to see if someone "Just happened to
know" the internals of how to go backwards thru one specific type of
queue.  *Documenting* how to go backwards for a tailq in the man page
is not an appropriate solution, because the result is a bunch of loose
C code which is breaking the abstraction of "a generic queue".

-- 
Garance Alistair Drosehn            =   gad@eclipse.acs.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05101006b85a9329f10b>