From: Michael Ellerman <michael@ellerman.id.au>
To: Tabi Timur-B04825 <B04825@freescale.com>
Cc: Aggrwal Poonam-B10812 <B10812@freescale.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
Singh Sandeep-B37400 <B37400@freescale.com>
Subject: Re: [2/3][PATCH][upstream] TDM Framework
Date: Wed, 25 Jul 2012 15:18:31 +1000 [thread overview]
Message-ID: <1343193511.2218.10.camel@concordia> (raw)
In-Reply-To: <500F5C99.6060704@freescale.com>
On Wed, 2012-07-25 at 02:40 +0000, Tabi Timur-B04825 wrote:
> Michael Ellerman wrote:
> > I agree these values are odd. But there's no rule that you can only use
> > an enum if the values are monotonically increasing.
> >
> > It can still serve as helpful documentation, and reduce the number of
> > places you pass a bare int around.
>
> IMHO, an enum should only be used if
>
> 1) You are doing real type checking of the enum
Yes, if you're going to define an enum you should use it, which this
patch doesn't, but that's just a bug in this patch.
> 2) You don't care what the actual values of each enum is
I disagree.
They make even more sense when you don't care what the values are, but
that doesn't mean you should only use them in those cases.
And the bible, K & R, includes an example of an enum which explicitly
specifies all its values. It goes on to say "enumeration variables offer
the chance of [type] checking and so are often better than #defines".
cheers
next prev parent reply other threads:[~2012-07-25 5:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-23 10:49 [2/3][PATCH][upstream] TDM Framework b37400
2012-07-23 10:49 ` [1/3][PATCH][upstream]Adding documentation for TDM b37400
2012-07-23 10:49 ` [3/3][PATCH][upstream]Added TDM device support and Freescale Starlite driver b37400
2012-07-23 12:32 ` [1/3][PATCH][upstream]Adding documentation for TDM David Laight
2012-07-24 15:12 ` Aggrwal Poonam-B10812
2012-07-25 8:44 ` David Laight
2012-07-25 12:08 ` Aggrwal Poonam-B10812
2012-07-23 16:33 ` [2/3][PATCH][upstream] TDM Framework Tabi Timur-B04825
2012-07-24 13:22 ` Singh Sandeep-B37400
2012-07-24 14:43 ` Timur Tabi
2012-07-24 23:43 ` Michael Ellerman
2012-07-25 2:40 ` Tabi Timur-B04825
2012-07-25 5:18 ` Michael Ellerman [this message]
2012-07-26 21:28 ` Timur Tabi
2012-07-26 22:09 ` Scott Wood
2012-07-26 10:49 ` Singh Sandeep-B37400
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=1343193511.2218.10.camel@concordia \
--to=michael@ellerman.id.au \
--cc=B04825@freescale.com \
--cc=B10812@freescale.com \
--cc=B37400@freescale.com \
--cc=linuxppc-dev@lists.ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).