lkml.org 
[lkml]   [2008]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Comma at end of enum lists
On Sat, Mar 29, 2008 at 10:28:26AM -0700, H. Peter Anvin wrote:
> Yes, it is.
>
> I personally prefer it this way (strongly) for exactly the same reason C
> requires a semicolon at the end of each statement, as opposed to Pascal
> which doesn't require a semicolon immediately before an "end".

enum foo {
Foo,
Bar,
Baz,
Max_foo = Baz
};

when you know there won't any additions past the last line (for that matter,
ending it with
Baz,
Sentry_foo,
Max_foo = Sentry_foo - 1
}; is also an option, in which case the end of enum will never be touched
at all).

enum {Some_constant = ...};

when you do not want to mix it with other constants and use a separate
enum for each natural group.

Sometimes it makes sense, sometimes it doesn't. It is an expressive
element, not something to be cast in stone by Documentation/CodingStyle.


\
 
 \ /
  Last update: 2008-03-29 18:55    [W:0.050 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site