Re: [PATCH] pedantic code cleanup - am I wasting my time with this?

From: Jesper Juhl (juhl@eisenstein.dk)
Date: Mon Apr 23 2001 - 11:23:20 EST


Richard Gooch wrote:

> Jesper Juhl writes:
>
>> All the above does is to remove the last comma from 3 enumeration
>> lists. I know that gcc has no problem with that, but to be strictly
>> correct the last entry should not have a trailing comma.
>
>
> But it's more people-friendly to have that trailing comma. It makes
> adding new enumerations just slightly easier, and also makes it easier
> to manually apply failed patches. I'd rather see those trailing commas
> left in.

>

You are right. As several people have pointed out to me it is in fact
legal to have the trailing comma. And it _does_ make it easier to add
new lines.
At least I have learned a lesson here; be 100% sure of your facts before
posting to linux-kernel ;)

>
>> Another example is the following line (1266) from linux/include/net/sock.h
>>
>> return (waitall ? len : min(sk->rcvlowat, len)) ? : 1;
>>
>> To be strictly correct the second expression (between '?' and ':' )
>> should not be omitted (all you guys already know that ofcourse).
>
>
> Yeah, that one's pretty ugly and unreadable.
>

That function (sock_rcvlowat()) only gets called a few places, so I'll
see if I can figure out exactely what's going on and come up with a
better construct (it might take me ages, but I'm determined to learn to
find my way around this code)...

>
> Go ahead and make suggestions. I expect some things will be accepted,
> some rejected (just like I did). Steer clear of any brace or tabbing
> style changes, though.
>

Ok, I'll continue reading code and keep my eyes open for these things.

[...]

> The goal should *not* be to shut up gcc. The goal should be to produce
> more readable code and to fix bugs. Gcc is merely a tool. And a flawed
> one, at that.
>

I'll remember that. Thank you to everyone who have taken their time to
answer my post, you have all been very helpfull!

- Jesper Juhl - juhl@eisenstein.dk

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Apr 23 2001 - 21:00:46 EST