From: Roland Dreier <rdreier@cisco.com>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: Steve Wise <swise@opengridcomputing.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] iWARP Connection Manager.
Date: Wed, 31 May 2006 14:54:22 -0700 [thread overview]
Message-ID: <adaverlx3ld.fsf@cisco.com> (raw)
In-Reply-To: <20060531140100.36024296@localhost.localdomain> (Stephen Hemminger's message of "Wed, 31 May 2006 14:01:00 -0700")
This is a silly thing to argue about, but...
> The preferred form for passing a size of a struct is the following:
>
> p = kmalloc(sizeof(*p), ...);
>
> The alternative form where struct name is spelled out hurts readability and
> introduces an opportunity for a bug when the pointer variable type is changed
> but the corresponding sizeof that is passed to a memory allocator is not.
I would argue that this is talking about sizeof(*p) vs. sizeof (struct foo)
rather than sizeof(*p) vs. sizeof *p.
You wouldn't write:
return(*p);
but rather
return *p;
And sizeof is an operator not a function, so I think the same usage
would apply.
With that said the prevalent kernel usage does seem to be sizeof(*foo)
(by about 10 to 1). But I can't help feeling it looks silly.
- R.
next prev parent reply other threads:[~2006-05-31 21:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-31 18:26 [PATCH 0/2][RFC] iWARP Core Support Steve Wise
2006-05-31 18:26 ` [PATCH 1/2] iWARP Connection Manager Steve Wise
2006-05-31 18:40 ` Stephen Hemminger
2006-05-31 19:24 ` Roland Dreier
2006-05-31 20:47 ` Muli Ben-Yehuda
2006-05-31 20:58 ` Steve Wise
2006-05-31 21:01 ` Stephen Hemminger
2006-05-31 21:54 ` Roland Dreier [this message]
2006-05-31 22:22 ` Steve Wise
2006-05-31 22:22 ` Sean Hefty
2006-06-01 17:00 ` Steve Wise
2006-06-01 21:09 ` Sean Hefty
2006-06-01 22:21 ` [openib-general] " Tom Tucker
2006-06-01 17:11 ` Tom Tucker
2006-05-31 18:26 ` [PATCH 2/2] iWARP Core Changes Steve Wise
2006-05-31 18:36 ` Stephen Hemminger
2006-05-31 19:17 ` Roland Dreier
2006-05-31 20:30 ` Steve Wise
2006-05-31 20:32 ` Roland Dreier
2006-05-31 21:26 ` Sean Hefty
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=adaverlx3ld.fsf@cisco.com \
--to=rdreier@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=shemminger@osdl.org \
--cc=swise@opengridcomputing.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