All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Jacek Luczak <difrost.kernel@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: Comma at end of enum lists
Date: Sat, 29 Mar 2008 17:52:27 +0000	[thread overview]
Message-ID: <20080329175227.GB9785@ZenIV.linux.org.uk> (raw)
In-Reply-To: <47EE7C3A.5000909@zytor.com>

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.

  parent reply	other threads:[~2008-03-29 17:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-29 17:00 Comma at end of enum lists Jacek Luczak
2008-03-29 17:19 ` Mikael Pettersson
2008-03-29 17:22   ` Jacek Luczak
2008-03-29 18:13   ` Andreas Schwab
2008-03-29 18:24     ` Jan Engelhardt
2008-03-29 18:47       ` Andreas Schwab
2008-03-29 17:20 ` H. Peter Anvin
2008-03-29 17:25   ` Al Viro
2008-03-29 17:26     ` Jacek Luczak
2008-03-29 17:56       ` Al Viro
2008-03-29 17:57         ` H. Peter Anvin
2008-03-29 17:28     ` H. Peter Anvin
2008-03-29 17:42       ` Jan Engelhardt
2008-03-29 17:52       ` Al Viro [this message]
2008-03-29 17:54         ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080329175227.GB9785@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=difrost.kernel@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.