Thread (9 messages) flat view 9 messages, 5 authors, 2015-12-10

Re: [PATCH 1/4] list: introduce list_is_first()

From: Christoph Hellwig <hch@infradead.org>
Date: 2015-12-10 15:36:08
Also in: lkml, netfilter-devel

On Thu, Dec 10, 2015 at 09:23:57AM -0600, Josh Poimboeuf wrote:
Personally I would disagree.  Something like:

  if (list_is_first(&rq->queuelist, &nd->queue))

is much more readable to me than:

  if (rq->queuelist.prev == &nd->queue)

The first one takes no effort for me -- it's almost English.  While the
second one takes me a few seconds (and some precious brain cycles) to
decipher.

Maybe whether it's readable depends on how many years you've been
looking at the pattern.  But IMHO we shouldn't make "having x # of years
staring at kernel code" a prerequisite for being able to read kernel
code.
I think understanding the list.h semantics is a requirement for writing
(or reading) non-trivial kernel code.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help