From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753165AbbGALz7 (ORCPT ); Wed, 1 Jul 2015 07:55:59 -0400 Received: from smtprelay06.ispgateway.de ([80.67.31.96]:42060 "EHLO smtprelay06.ispgateway.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750935AbbGALzv (ORCPT ); Wed, 1 Jul 2015 07:55:51 -0400 Message-ID: <5593D4F5.1090106@ladisch.de> Date: Wed, 01 Jul 2015 13:54:29 +0200 From: Clemens Ladisch User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Joe Perches , LKML CC: Dan Carpenter , Julia Lawall , Andrew Morton Subject: Re: RFC: kernel coding style: prefer array to &array[0] ? References: <1435685746.12101.18.camel@perches.com> In-Reply-To: <1435685746.12101.18.camel@perches.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Df-Sender: bGludXgta2VybmVsQGNsLmRvbWFpbmZhY3Rvcnkta3VuZGUuZGU= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Joe Perches wrote: > It seems most in-kernel uses are 'array' rather than '&array[0]' > > Most of the time, using array is simpler to read than &array[0]. > > Exceptions exists when addresses for consecutive members are > used like func(&array[0], &array[1]); I use '&array[0]' when I want to get a pointer to a single object that happens to be the first one in an array. > Should this preference be put into checkpatch and/or CodingStyle? How about the following low-hanging fruit? foo(..., &array[0], ARRAY_SIZE(array), ...) Regards, Clemens