Messages in this thread | | | Date | Sat, 29 Mar 2008 17:52:27 +0000 | From | Al Viro <> | Subject | Re: 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.
| |