Computer Old Farts Forum
 help / color / mirror / Atom feed
From: crossd at gmail.com (Dan Cross)
Subject: [COFF] [TUHS] Tech Sq elevator [ really type-checking ]
Date: Sun, 12 Jan 2020 20:23:11 -0500	[thread overview]
Message-ID: <CAEoi9W5Qo4-ia6VAQn79pdhoZ4BKF3+qzL8xQhuYoAiEMcq+Zg@mail.gmail.com> (raw)
In-Reply-To: <AB452025-FCE9-4D41-992A-D3135683A6D6@bitblocks.com>

-TUHS, +COFF, in line with Warren's wishes.

On Sun, Jan 12, 2020 at 7:36 PM Bakul Shah <bakul at bitblocks.com> wrote:

> There is similar code in FreeBSD kernel. Embedding head and next ptrs
> reduces
> memory allocation and improves cache locality somewhat. Since C doesn't
> have
> generics, they try to gain the same functionality with macros. See
>
> https://github.com/freebsd/freebsd/blob/master/sys/sys/queue.h
>
> Not that this is the same as what Linux does (which I haven't dug into) but
> I suspect they may have had similar motivation.
>

I was actually going to say, "blame Berkeley." As I understand it, this
code originated in BSD, and the Linux implementation is at least inspired
by the BSD code. There was code for singly and doubly linked lists, queues,
FIFOs, etc.

I can actually understand the motivation: lists, etc, are all over the
place in a number of kernels. The code to remove an element from a list is
trivial, but also tedious and repetitive: if it can be wrapped up into a
macro, why not do so? It's one less thing to mess up.

I agree it's gone off the rails, however.

        - Dan C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/coff/attachments/20200112/b3fa8f64/attachment.html>


  parent reply	other threads:[~2020-01-13  1:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <202001122225.00CMPc9S085970@tahoe.cs.Dartmouth.EDU>
     [not found] ` <CAK7dMtBHfc35vb+5XP6WcBXDKsFyMxFSZ8vfgen7_5jgrnNxnQ@mail.gmail.com>
     [not found]   ` <202001122340.00CNeef0604557@darkstar.fourwinds.com>
     [not found]     ` <AB452025-FCE9-4D41-992A-D3135683A6D6@bitblocks.com>
     [not found]       ` <202001130044.00D0ilcV616661@darkstar.fourwinds.com>
2020-01-13  0:49         ` wkt
2020-01-13  1:23       ` crossd [this message]
2020-01-13  1:41         ` bakul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEoi9W5Qo4-ia6VAQn79pdhoZ4BKF3+qzL8xQhuYoAiEMcq+Zg@mail.gmail.com \
    --to=coff@minnie.tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).