Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753571AbaKQNqA (ORCPT ); Mon, 17 Nov 2014 08:46:00 -0500 Received: from charlotte.tuxdriver.com ([70.61.120.58]:42839 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753426AbaKQNpo (ORCPT ); Mon, 17 Nov 2014 08:45:44 -0500 Date: Mon, 17 Nov 2014 08:36:19 -0500 From: "John W. Linville" To: Fabian Frederick Cc: Julian Calaby , Johannes Berg , linux-wireless , Larry Finger , Chaoming Li , netdev , "linux-kernel@vger.kernel.org" , Emmanuel Grumbach , b43-dev , Stefano Brivio , Intel Linux Wireless Subject: Re: [PATCH 1/1 net-next] wireless: remove unnecessary sizeof(u8) Message-ID: <20141117133618.GC3511@tuxdriver.com> References: <1415998553-12636-1-git-send-email-fabf@skynet.be> <828430032.148603.1416203787175.open-xchange@webmail.nmp.skynet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <828430032.148603.1416203787175.open-xchange@webmail.nmp.skynet.be> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 17, 2014 at 06:56:27AM +0100, Fabian Frederick wrote: > > > > On 16 November 2014 at 23:33 Julian Calaby wrote: > > > > > > Hi Fabian, > > > > On Sat, Nov 15, 2014 at 7:55 AM, Fabian Frederick 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/