2002-07-18 03:19:54

by Rusty Russell

[permalink] [raw]
Subject: Remain Calm: Designated initializer patches for 2.5

Hi all,

I just sent about 40 reasonable-size patches through the
Trivial Patch Monkey to Linus: these patches replace the (deprecated)
"foo: " designated initializers with the ISO-C ".foo =" initializers.
GCC has understood both since forever, but the kernel took a wrong
bet, and we're better off setting a good example for 2.6 before we
start getting about 10,000 warnings.

So far, Art Haas has done all the fs code, and will presumably
be working through the other code on dir at a time.

Just a heads-up,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.


2002-07-18 03:31:38

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

Em Thu, Jul 18, 2002 at 01:22:23PM +1000, Rusty Russell escreveu:
> Hi all,
>
> I just sent about 40 reasonable-size patches through the
> Trivial Patch Monkey to Linus: these patches replace the (deprecated)
> "foo: " designated initializers with the ISO-C ".foo =" initializers.
> GCC has understood both since forever, but the kernel took a wrong
> bet, and we're better off setting a good example for 2.6 before we
> start getting about 10,000 warnings.
>
> So far, Art Haas has done all the fs code, and will presumably
> be working through the other code on dir at a time.
>
> Just a heads-up,

Did this ones touched the net/{ipv4,ipv6,appletalk} dirs? I'm working on
general cleanups in those and this is one of the things I'm doing, again
just a heads up.

- Arnaldo

PS.: deliver_to_old_ones_users-- will happen for Appletalk 8)

2002-07-18 06:31:41

by H. Peter Anvin

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

Rusty Russell wrote:
> Hi all,
>
> I just sent about 40 reasonable-size patches through the
> Trivial Patch Monkey to Linus: these patches replace the (deprecated)
> "foo: " designated initializers with the ISO-C ".foo =" initializers.
> GCC has understood both since forever, but the kernel took a wrong
> bet, and we're better off setting a good example for 2.6 before we
> start getting about 10,000 warnings.
>
> So far, Art Haas has done all the fs code, and will presumably
> be working through the other code on dir at a time.
>

As far as I could tell, *ALL* of these changes broke text alignment in
columns. It would have been a lot better if they had maintained
spacing; I find the new code much more cluttered and hard to read.

-hpa


2002-07-18 06:35:47

by David Miller

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

From: "H. Peter Anvin" <[email protected]>
Date: Wed, 17 Jul 2002 23:32:35 -0700

As far as I could tell, *ALL* of these changes broke text alignment in
columns. It would have been a lot better if they had maintained
spacing; I find the new code much more cluttered and hard to read.

I have to admit that I hate the new syntax too. The GCC syntax is
so much nicer.

2002-07-18 06:48:17

by H. Peter Anvin

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

David S. Miller wrote:
> From: "H. Peter Anvin" <[email protected]>
> Date: Wed, 17 Jul 2002 23:32:35 -0700
>
> As far as I could tell, *ALL* of these changes broke text alignment in
> columns. It would have been a lot better if they had maintained
> spacing; I find the new code much more cluttered and hard to read.
>
> I have to admit that I hate the new syntax too. The GCC syntax is
> so much nicer.

The C99 syntax actually has some advantages (I believe it lets you
initialize array elements in a saner way), but my complaint had to do
with the fact that whitespace for alignment wasn't preserved.

-hpa

2002-07-18 06:52:12

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

Em Wed, Jul 17, 2002 at 11:28:32PM -0700, David S. Miller escreveu:
> From: "H. Peter Anvin" <[email protected]>
> Date: Wed, 17 Jul 2002 23:32:35 -0700
>
> As far as I could tell, *ALL* of these changes broke text alignment in
> columns. It would have been a lot better if they had maintained
> spacing; I find the new code much more cluttered and hard to read.
>
> I have to admit that I hate the new syntax too. The GCC syntax is
> so much nicer.

Well, I also like the non C99 variant that is in gcc as well, but if gcc is
going to drop that in the future in favour of the C99 standard... But yes,
not having the spacing is _ugly_, what I'm doing is:

static struct proto_ops SOCKOPS_WRAPPED(atalk_dgram_ops) = {
.family = PF_APPLETALK,
.release = atalk_release,
.bind = atalk_bind,
.connect = atalk_connect,
.socketpair = sock_no_socketpair,
.accept = sock_no_accept,
.
.
.

8)

- Arnaldo

2002-07-18 07:03:46

by H. Peter Anvin

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

Arnaldo Carvalho de Melo wrote:
>
> Well, I also like the non C99 variant that is in gcc as well, but if gcc is
> going to drop that in the future in favour of the C99 standard... But yes,
> not having the spacing is _ugly_, what I'm doing is:
>
> static struct proto_ops SOCKOPS_WRAPPED(atalk_dgram_ops) = {
> .family = PF_APPLETALK,
> .release = atalk_release,
> .bind = atalk_bind,
> .connect = atalk_connect,
> .socketpair = sock_no_socketpair,
> .accept = sock_no_accept,

Agreed, that's the way to do it.

-hpa


2002-07-18 07:31:27

by Anton Altaparmakov

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

At 07:56 18/07/02, H. Peter Anvin wrote:
>Arnaldo Carvalho de Melo wrote:
>>Well, I also like the non C99 variant that is in gcc as well, but if gcc is
>>going to drop that in the future in favour of the C99 standard... But yes,
>>not having the spacing is _ugly_, what I'm doing is:
>>static struct proto_ops SOCKOPS_WRAPPED(atalk_dgram_ops) = {
>> .family = PF_APPLETALK,
>> .release = atalk_release,
>> .bind = atalk_bind,
>> .connect = atalk_connect,
>> .socketpair = sock_no_socketpair,
>> .accept = sock_no_accept,
>
>Agreed, that's the way to do it.

Yes, the patch for ntfs that just found its way into my inbox is _really_
ugly... Something like the above would be much nicer.

Anton


--
"I've not lost my mind. It's backed up on tape somewhere." - Unknown
--
Anton Altaparmakov <aia21 at cantab.net> (replace at with @)
Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/

2002-07-18 08:54:33

by Rusty Russell

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

In message <[email protected]> you write:
> As far as I could tell, *ALL* of these changes broke text alignment in
> columns.

True.

> It would have been a lot better if they had maintained spacing; I
> find the new code much more cluttered and hard to read.

I thought about this: I agree it doesn't look as neat, but "hard to
read" for what purpose? It's just as easy to find a particular field
you're looking for and it's just as easy to find the end of the
declaration: I couldn't come up with a convincing argument for needing
to skim-read these declarations, so I didn't complain to the author.

Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

2002-07-18 08:54:32

by Rusty Russell

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

In message <[email protected]> you write:
> Did this ones touched the net/{ipv4,ipv6,appletalk} dirs? I'm working on
> general cleanups in those and this is one of the things I'm doing, again
> just a heads up.

Not yet, but if you get in first, Art won't have to.

Cheers!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

2002-07-18 09:31:29

by H. Peter Anvin

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

Rusty Russell wrote:
> In message <[email protected]> you write:
>
>>As far as I could tell, *ALL* of these changes broke text alignment in
>>columns.
>
>
> True.
>
>
>>It would have been a lot better if they had maintained spacing; I
>>find the new code much more cluttered and hard to read.
>
>
> I thought about this: I agree it doesn't look as neat, but "hard to
> read" for what purpose? It's just as easy to find a particular field
> you're looking for and it's just as easy to find the end of the
> declaration: I couldn't come up with a convincing argument for needing
> to skim-read these declarations, so I didn't complain to the author.
>

Neatness is about making it easy to read code *quickly*. The pattern
recognizer in your brain doesn't work as well on a jumbled mess.

-hpa



2002-07-18 13:42:41

by Daniel Phillips

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

On Thursday 18 July 2002 05:22, Rusty Russell wrote:
> I just sent about 40 reasonable-size patches through the
> Trivial Patch Monkey to Linus: these patches replace the (deprecated)
> "foo: " designated initializers with the ISO-C ".foo =" initializers.
> GCC has understood both since forever, but the kernel took a wrong
> bet, and we're better off setting a good example for 2.6 before we
> start getting about 10,000 warnings.

Next time, remember to bet on the ugliest looking one ;-)

--
Daniel

2002-07-19 01:40:42

by Rusty Russell

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

In message <E17VBcZ-0004oO-00@starship> you write:
> On Thursday 18 July 2002 05:22, Rusty Russell wrote:
> > GCC has understood both since forever, but the kernel took a wrong
> > bet, and we're better off setting a good example for 2.6 before we
> > start getting about 10,000 warnings.
>
> Next time, remember to bet on the ugliest looking one ;-)

I agreed, until I recently did a big grep to find these things. I now
concur with the C9X committee. ".foo = " is clearly distinguished
from bitfield declarations and labels, which "foo: " isn't.

Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

2002-07-19 07:33:53

by Marcin Dalecki

[permalink] [raw]
Subject: Re: Remain Calm: Designated initializer patches for 2.5

Rusty Russell wrote:
> In message <E17VBcZ-0004oO-00@starship> you write:
>
>>On Thursday 18 July 2002 05:22, Rusty Russell wrote:
>>
>>>GCC has understood both since forever, but the kernel took a wrong
>>>bet, and we're better off setting a good example for 2.6 before we
>>>start getting about 10,000 warnings.
>>
>>Next time, remember to bet on the ugliest looking one ;-)
>
>
> I agreed, until I recently did a big grep to find these things. I now
> concur with the C9X committee. ".foo = " is clearly distinguished
> from bitfield declarations and labels, which "foo: " isn't.

Of hand I think about the following *technical* points:

1. It resembles the usage case similar to other initalizations.

2. It makes for less reduce/reduce conflicts in the LR-grammar
parser generator.

Its better and more outtought then the GNU "extension".