Skip to contentSkip to conversation

Remain Calm: Designated initializer patches for 2.5

DISCUSSION Rusty Russell 7 participants 14 messages Jul 18, 2002 – Jul 19, 2002

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw

Em Thu, Jul 18, 2002 at 01:22:23PM +1000, Rusty Russell escreveu:

Quoted 9 lines

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.

Quoted 4 lines

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)

#3 lore raw
In reply to Rusty Russell
Quoted 9 lines · Rusty Russell

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.

Quoted 3 lines

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

#4 lore raw

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.

#5 lore raw
Quoted 9 lines · David S. Miller

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

#6 lore raw
In reply to David S. Miller

Em Wed, Jul 17, 2002 at 11:28:32PM -0700, David S. Miller escreveu:

Quoted 9 lines

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

#7 lore raw
Quoted 5 lines · Arnaldo Carvalho de Melo

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:

Quoted 7 lines

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

#8 lore raw
Quoted 12 lines · H. Peter Anvin
Quoted 10 lines · Arnaldo Carvalho de Melo

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,
Quoted 1 line

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

Signature · 5 lines
  "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/
#2 lore raw
In reply to Arnaldo Carvalho de Melo

In message <[email protected]> you write:

Quoted 3 lines

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.

#9 lore raw
In reply to H. Peter Anvin

In message <[email protected]> you write:

Quoted 2 lines

As far as I could tell, *ALL* of these changes broke text alignment in columns.

True.

Quoted 2 lines

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.

#10 lore raw
Quoted 12 lines · Rusty Russell

In message <[email protected]> you write:

Quoted 1 line

As far as I could tell, *ALL* of these changes broke text alignment in columns.

True.

Quoted 2 lines

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

Quoted 6 lines

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

#11 lore raw
In reply to Rusty Russell
Quoted 6 lines · Rusty Russell

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 ;-)

Signature · 1 line
Daniel
#12 lore raw

In message <E17VBcZ-0004oO-00@starship> you write:

Quoted 6 lines · Rusty Russell
Quoted 3 lines

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.

#13 lore raw
Quoted 8 lines · Rusty Russell

In message <E17VBcZ-0004oO-00@starship> you write:

Quoted 6 lines · Rusty Russell
Quoted 4 lines

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.

Quoted 6 lines
Quoted 1 line

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".