From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753822AbYITWHx (ORCPT ); Sat, 20 Sep 2008 18:07:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751539AbYITWHp (ORCPT ); Sat, 20 Sep 2008 18:07:45 -0400 Received: from smtp6-g19.free.fr ([212.27.42.36]:59701 "EHLO smtp6-g19.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470AbYITWHo (ORCPT ); Sat, 20 Sep 2008 18:07:44 -0400 Message-ID: <48D5742F.6080305@free.fr> Date: Sun, 21 Sep 2008 00:07:43 +0200 From: Chris Moore User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Christer Weinigel CC: Alexey Dobriyan , Russ Dill , linux-kernel@vger.kernel.org, Cyrill Gorcunov , Ben Dooks , linux-arm-kernel@lists.arm.linux.org.uk Subject: Re: kernel.h: add ARRAY_AND_SIZE() macro to complement ARRAY_SIZE(). References: <20080918132447.516309749@fluff.org.uk> <20080918150624.GA3421@x200.localdomain> <20080919065426.GA7222@lenovo> <20080919175544.GA3228@x200.localdomain> <48D4F519.2080509@weinigel.se> In-Reply-To: <48D4F519.2080509@weinigel.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christer Weinigel a écrit : > Alexey Dobriyan wrote: > >> On Fri, Sep 19, 2008 at 08:28:45AM -0700, Russ Dill wrote: >> >>> My vote is for ARRAY_AND_SIZE to spread far and wide across the land. >>> ARRAY_SIZE is already very safe, as it has a __must_be_array macro >>> built in. So ARRAY_AND_SIZE is even safer, as it prevents you from >>> mixing up two different arrays. It also reduces line length and makes >>> driver and device (usually platform_device) registration code easier >>> to read. >>> >> It also spreads ARRAY_SIZE misnaming futher. >> > > You still haven't explained what's misnamed about it, nor suggested a > better name. > ARRAY_LENGTH and ARRAY_AND_LENGTH would be better names IMHO. AIUI the usual convention is to use :- - "size" for the size in the sizeof sense; i.e. (in most implementations) the size in _bytes_, - "length" for the size in the sense of the number of _elements_ in an array (sizeof(array) / sizeof((array)[0])) which seems to be the intention here. Cheers, Chris