lkml.org 
[lkml]   [2020]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 00/18] use semicolons rather than commas to separate statements


On Tue, 29 Sep 2020, Dan Carpenter wrote:

> On Tue, Sep 29, 2020 at 02:20:00PM +0200, Ard Biesheuvel wrote:
> > On Sun, 27 Sep 2020 at 21:56, Julia Lawall <Julia.Lawall@inria.fr> wrote:
> > >
> > > These patches replace commas by semicolons.
> >
> >
> > Why?
> >
>
> In the best case, these commas are just uninitentional mess, like typing
> an extra space character or something. I've looked at them before and
> one case I see where they are introduced is when people convert a
> struct initializer to code.
>
> - struct foo {
> - .a = 1,
> - .b = 2,
> ...
> + foo.a = 1,
> + foo.b = 2,
>
> The times where commas are used deliberately to replace curly braces are
> just evil. Either way the code is cleaner with semi-colons.

I also found exaamples like the following to be particularly unforunate:

fprintf(stderr,
"page_nr %lu wrong count %Lu %Lu\n",
page_nr, count,
count_verify[page_nr]), exit(1);

The exit is very hard to see, unless you know to look for it.

julia

\
 
 \ /
  Last update: 2020-09-29 14:49    [W:0.098 / U:1.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site