Search Linux Wireless

Re: [PATCH 1/1 net-next] wireless: remove unnecessary sizeof(u8)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 17, 2014 at 06:56:27AM +0100, Fabian Frederick wrote:
> 
> 
> > On 16 November 2014 at 23:33 Julian Calaby <julian.calaby@xxxxxxxxx> wrote:
> >
> >
> > Hi Fabian,
> >
> > On Sat, Nov 15, 2014 at 7:55 AM, Fabian Frederick <fabf@xxxxxxxxx> 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@xxxxxxxxxxxxx			might be all we have.  Be ready.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux