From: Dan Carpenter <dan.carpenter@oracle.com>
To: Joe Perches <joe@perches.com>
Cc: Spencer Baugh <sbaugh@andrew.cmu.edu>,
"open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
gregkh@linuxfoundation.org,
Hongchao Zhang <hongchao.zhang@intel.com>,
Niu Yawei <yawei.niu@intel.com>,
Alex Zhuravlev <alexey.zhuravlev@intel.com>,
open list <linux-kernel@vger.kernel.org>,
Oleg Drokin <oleg.drokin@intel.com>
Subject: Re: [PATCH 2/3] staging: lustre: fix pointer whitespace style
Date: Mon, 8 Sep 2014 13:32:08 +0300 [thread overview]
Message-ID: <20140908103208.GK6600@mwanda> (raw)
In-Reply-To: <1410027543.2723.8.camel@joe-AO725>
On Sat, Sep 06, 2014 at 11:19:03AM -0700, Joe Perches wrote:
>
> Indexing a string array with an enum is generally unsafe.
>
> I think it better to use a switch/case like:
>
The reverse side of that argument is that switch statements are slower
and uglier.
My understanding is that according to the c spec, "state" could be
signed but in this case GCC defines it as unsigned int. So the ASSERT
is ok in real life, but in theory it should check for negatives as well.
regards,
dan carpenter
next prev parent reply other threads:[~2014-09-08 10:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-06 17:38 [PATCH 1/3] staging: lustre: fix function definition style Spencer Baugh
2014-09-06 17:38 ` [PATCH 2/3] staging: lustre: fix pointer whitespace style Spencer Baugh
2014-09-06 18:19 ` Joe Perches
2014-09-08 10:32 ` Dan Carpenter [this message]
2014-09-08 11:37 ` Joe Perches
2014-09-06 17:38 ` [PATCH 3/3] staging: lustre: remove trailing whitespace Spencer Baugh
2014-09-08 19:40 ` [PATCH 1/3] staging: lustre: fix function definition style Greg KH
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=20140908103208.GK6600@mwanda \
--to=dan.carpenter@oracle.com \
--cc=alexey.zhuravlev@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=hongchao.zhang@intel.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg.drokin@intel.com \
--cc=sbaugh@andrew.cmu.edu \
--cc=yawei.niu@intel.com \
/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.