From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161260AbcFBQsS (ORCPT ); Thu, 2 Jun 2016 12:48:18 -0400 Received: from smtprelay0203.hostedemail.com ([216.40.44.203]:50617 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753472AbcFBQsR (ORCPT ); Thu, 2 Jun 2016 12:48:17 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2691:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:5007:6119:7807:8603:9040:10004:10400:10848:11026:11232:11658:11783:11914:12043:12438:12517:12519:12555:12740:13069:13311:13357:13439:13894:14040:14659:21080:21434:30030:30054:30070:30079:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: steam19_d707bdae7602 X-Filterd-Recvd-Size: 2417 Message-ID: <1464886091.14627.100.camel@perches.com> Subject: Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays From: Joe Perches To: George Spelvin , andriy.shevchenko@linux.intel.com Cc: akpm@linux-foundation.org, bbjorn@mork.no, linux-kernel@vger.kernel.org, tytso@mit.edu Date: Thu, 02 Jun 2016 09:48:11 -0700 In-Reply-To: <20160601150705.27355.qmail@ns.sciencehorizons.net> References: <20160601150705.27355.qmail@ns.sciencehorizons.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2016-06-01 at 11:07 -0400, George Spelvin wrote: > On Wed, 01 Jun 2016 at 15:32:47, Andy Shevchenko wrote: > > On Tue, 2016-05-31 at 14:36 -0700, Joe Perches wrote: > > > On Tue, 2016-05-31 at 16:31 -0400, George Spelvin wrote: > > > > -static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 > > > > ei[16]) > > > > +static int __uuid_to_bin(const char uuid[36], __u8 b[16], const u8 > > > > si[16]) > > > Functions with sized array arguments are generally undesired. > > That function follows existing UUID API. Since we have now it > > consolidated in one place someone may fix it eventually. > Just to clarify: > > int foo(char *); > int foo(char *floccinaucinihilipilifcation); > int foo(char *p); > int foo(char p[]); > int foo(char []); > int foo(char p[1]); > int foo(char p[999999999]); > > are all the exact same declaration.  There is no API change; the only > difference is stylistic.  (Try it!  Copy them to a .c file and > compile it.  Observe the lack of conflicting declaration warnings.) > > Although the compiler doesn't care, I happen to prefer to include > parameter names for the benefit of someone reading the header files. > > For the same reason, if the pointer is to the start of an array with > definite length (that's not 1), I prefer to use the array form showing > that length. > > But it's a matter of style, not substance, either way. I believe the substantive bit of the argument is the ability to misunderstand that sizeof(argument with size char[999]) is not 999 but is sizeof(*).