From: Matt Mackall <mpm@selenic.com>
To: "Robert P. J. Day" <rpjday@mindspring.com>
Cc: Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: a quick survey: "FIELD_SIZEOF" or "MEMBER_SIZE"?
Date: Sat, 3 Feb 2007 02:45:26 -0600 [thread overview]
Message-ID: <20070203084526.GG16722@waste.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0702030243350.23432@CPE00045a9c397f-CM001225dbafb6>
On Sat, Feb 03, 2007 at 02:49:34AM -0500, Robert P. J. Day wrote:
>
> pardon the interruption but, once upon a time, we were discussing
> cleaning up code to use the kernel.h-defined macro "FIELD_SIZEOF".
>
> some folks suggested that the macro name itself was kind of awkward
> as it didn't fit the pattern of "ARRAY_SIZE" defined in that same
> header file.
>
> because of a name clash, "FIELD_SIZE" is not available, but there
> was a suggestion of, uh, "MEMBER_SIZE". :-)
>
> so, really, those are the two viable choices -- stick with the
> current name of FIELD_SIZEOF, or switch to MEMBER_SIZE. switching is
> not a big deal since no one (at least, no one in the current tree)
> uses FIELD_SIZEOF as it is, so it's not as if it would be a disruptive
> change in the slightest.
K&R calls them 'members'.
We've currently got:
sizeof (built-in)
typeof (built-in)
offsetof (standard macro)
container_of (kernel macro) (1800 of these, ugh)
We don't want:
FIELD_SIZE - they're members
MEMBER_SIZE - inconsistent with the above
member_size - all the above have of
member_size_of - inconsistent with sizeof
member_sizeof - inconsistent _ between words
sizeof_member - same, plus other issues
memsizeof - confusion with memory
So my vote would be for:
membersizeof(a, b)
There's also at least two pieces of code that could use:
membertypeof(a, b)
And please kill all the reimplementations of offsetof while you're at it.
--
Mathematics is the supreme nostalgia of our time.
prev parent reply other threads:[~2007-02-03 8:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-03 7:49 a quick survey: "FIELD_SIZEOF" or "MEMBER_SIZE"? Robert P. J. Day
2007-02-03 8:45 ` Matt Mackall [this message]
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=20070203084526.GG16722@waste.org \
--to=mpm@selenic.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rpjday@mindspring.com \
/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