All of lore.kernel.org
 help / color / mirror / Atom feed
From: John W. Linville <linville@tuxdriver.com>
To: Fabian Frederick <fabf@skynet.be>
Cc: Julian Calaby <julian.calaby@gmail.com>,
	Johannes Berg <johannes.berg@intel.com>,
	linux-wireless <linux-wireless@vger.kernel.org>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Chaoming Li <chaoming_li@realsil.com.cn>,
	netdev <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
	b43-dev <b43-dev@lists.infradead.org>,
	Stefano Brivio <stefano.brivio@polimi.it>,
	Intel Linux Wireless <ilw@linux.intel.com>
Subject: [PATCH 1/1 net-next] wireless: remove unnecessary sizeof(u8)
Date: Mon, 17 Nov 2014 08:36:19 -0500	[thread overview]
Message-ID: <20141117133618.GC3511@tuxdriver.com> (raw)
In-Reply-To: <828430032.148603.1416203787175.open-xchange@webmail.nmp.skynet.be>

On Mon, Nov 17, 2014 at 06:56:27AM +0100, Fabian Frederick wrote:
> 
> 
> > On 16 November 2014 at 23:33 Julian Calaby <julian.calaby@gmail.com> wrote:
> >
> >
> > Hi Fabian,
> >
> > On Sat, Nov 15, 2014 at 7:55 AM, Fabian Frederick <fabf@skynet.be> wrote:
> > > sizeof(u8) is always 1.
> >
> > I thought that sizeof(*variable) was preferred over sizeof(type), so
> > shouldn't these be switched to that format instead?
> >
> > (I know that this is all no-op, but it should reduce the potential for
> > highly unlikely bugs in the future. Also, the extra processing is
> > compile-time not run-time.)
> >
> > Thanks,
> 
> Hi Julian,
> 
> Of course but char/u8/s8... allocations never use it and result would be the
> same:
> factor 1 multiplication.
> 
> Those rare occurrences (+- 30 in the whole kernel) where we have
> sizeof(u8/s8) is ambiguous.
> 
> Having a patch removing it gives a pointer...
> If the developer meant something else, he will be able to fix it.
> 
> Regards,
> Fabian

sizeof(*variable) still seems safer.  Are the compilers unable to
optimize-away a "multiply by one"?

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.

WARNING: multiple messages have this Message-ID (diff)
From: "John W. Linville" <linville@tuxdriver.com>
To: Fabian Frederick <fabf@skynet.be>
Cc: Julian Calaby <julian.calaby@gmail.com>,
	Johannes Berg <johannes.berg@intel.com>,
	linux-wireless <linux-wireless@vger.kernel.org>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Chaoming Li <chaoming_li@realsil.com.cn>,
	netdev <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
	b43-dev <b43-dev@lists.infradead.org>,
	Stefano Brivio <stefano.brivio@polimi.it>,
	Intel Linux Wireless <ilw@linux.intel.com>
Subject: Re: [PATCH 1/1 net-next] wireless: remove unnecessary sizeof(u8)
Date: Mon, 17 Nov 2014 08:36:19 -0500	[thread overview]
Message-ID: <20141117133618.GC3511@tuxdriver.com> (raw)
In-Reply-To: <828430032.148603.1416203787175.open-xchange@webmail.nmp.skynet.be>

On Mon, Nov 17, 2014 at 06:56:27AM +0100, Fabian Frederick wrote:
> 
> 
> > On 16 November 2014 at 23:33 Julian Calaby <julian.calaby@gmail.com> wrote:
> >
> >
> > Hi Fabian,
> >
> > On Sat, Nov 15, 2014 at 7:55 AM, Fabian Frederick <fabf@skynet.be> wrote:
> > > sizeof(u8) is always 1.
> >
> > I thought that sizeof(*variable) was preferred over sizeof(type), so
> > shouldn't these be switched to that format instead?
> >
> > (I know that this is all no-op, but it should reduce the potential for
> > highly unlikely bugs in the future. Also, the extra processing is
> > compile-time not run-time.)
> >
> > Thanks,
> 
> Hi Julian,
> 
> Of course but char/u8/s8... allocations never use it and result would be the
> same:
> factor 1 multiplication.
> 
> Those rare occurrences (+- 30 in the whole kernel) where we have
> sizeof(u8/s8) is ambiguous.
> 
> Having a patch removing it gives a pointer...
> If the developer meant something else, he will be able to fix it.
> 
> Regards,
> Fabian

sizeof(*variable) still seems safer.  Are the compilers unable to
optimize-away a "multiply by one"?

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

  reply	other threads:[~2014-11-17 13:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-14 20:55 [PATCH 1/1 net-next] wireless: remove unnecessary sizeof(u8) Fabian Frederick
2014-11-16 22:33 ` Julian Calaby
2014-11-16 22:33   ` Julian Calaby
2014-11-17  5:56   ` Fabian Frederick
2014-11-17  5:56     ` Fabian Frederick
2014-11-17 13:36     ` John W. Linville [this message]
2014-11-17 13:36       ` John W. Linville
     [not found]       ` <CAFpvzpxYrjR_tSF99iosMGZTAmt=_6o_aA+iYjNhxRGJ9aJ6oA@mail.gmail.com>
2014-11-18 16:12         ` Larry Finger
2014-11-18 16:12           ` Larry Finger

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=20141117133618.GC3511@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=b43-dev@lists.infradead.org \
    --cc=chaoming_li@realsil.com.cn \
    --cc=emmanuel.grumbach@intel.com \
    --cc=fabf@skynet.be \
    --cc=ilw@linux.intel.com \
    --cc=johannes.berg@intel.com \
    --cc=julian.calaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stefano.brivio@polimi.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.