Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1412426

Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays
Date 2016-06-02 18:50 +0200
Message-ID <rFDYJ-8hO-3@gated-at.bofh.it> (permalink)
References <rFfWp-1wV-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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(*).

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays "George Spelvin" <linux@sciencehorizons.net> - 2016-05-31 22:40 +0200
  Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays Joe Perches <joe@perches.com> - 2016-05-31 23:40 +0200
    Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays "George Spelvin" <linux@sciencehorizons.net> - 2016-06-01 00:10 +0200
    Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-06-01 14:40 +0200
      Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays "George Spelvin" <linux@sciencehorizons.net> - 2016-06-01 17:10 +0200
        Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays Joe Perches <joe@perches.com> - 2016-06-02 18:50 +0200
  Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays Andrew Morton <akpm@linux-foundation.org> - 2016-06-01 22:00 +0200
    Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-06-01 22:20 +0200
  Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-06-03 13:20 +0200

csiph-web