Re: [PATCH] CodingStyle update (was Re: URL to the latest /proc/

From: Jeremy Fitzhardinge (jeremy@goop.org)
Date: Sat Feb 19 2000 - 04:25:08 EST


On 18-Feb-00 Ron Flory wrote:
> Tigran Aivazian wrote:
>>
>> James Manning wrote:
>> > Good point Tigran... since it's officially preferred, it would appear to
>> > be a good candidate for CodingStyle inclusion. What do you think?
>>
>> IMHO, you are absolutely right.
>>
>> > +struct struct_type foo = {
>> > + field1: initializer1,
>> > + field2: initializer2,
>> > + field3: initializer3,
>> > +}
>> > +
>> > +The trailing comma on the last line allows for a homogenous look and easy
>> > +rearrangement (eg for later blocking of some members in an #ifdef).
>>
>> Thanks - I always wondered if it makes any difference to put the last
>> comma or not.
>
> it depends on the compiler. I have used at least one that emits a big
> nasty warning if one does that, so its not really portable.

It's perfectly legal C for arrays and structs, but it's not technically legal
for enums. Oversight in C89 I guess; it may be fixed in C0x... Anyway, g++
accepts trailing ',' in enum just fine.

        J

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



This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:23 EST