From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Borislav Petkov <bp@amd64.org>
Cc: "Luck, Tony" <tony.luck@intel.com>,
"Niklas Söderlund" <niso@kth.se>,
"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] i7core_edac: fix erroneous size of static array
Date: Thu, 13 Oct 2011 17:04:47 -0300 [thread overview]
Message-ID: <4E97445F.2040509@redhat.com> (raw)
In-Reply-To: <20111013191448.GD3064@aftab>
Em 13-10-2011 16:14, Borislav Petkov escreveu:
> On Thu, Oct 13, 2011 at 03:03:20PM -0400, Luck, Tony wrote:
>>> - static int cols[8] = {
>>> + static int cols[4] = {
>>
>> Why are these arrays "static"? Does that generate better code than
>> dynamic initialization?
>
> They look like lookup arrays for count of things based on bit settings
> and as such they should be static because they don't ... change :). If
> they were dynamic, then inlining them in every function callsite would
> be not cool.
Btw, it probably makes sense to also declare as "const". In this specific case,
it is likely that gcc will discover that it is const anyway, and do some
optimization, but sometimes gcc don't do what I would expect ;)
Mauro.
next prev parent reply other threads:[~2011-10-13 20:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-13 18:24 [PATCH] i7core_edac: fix erroneous size of static array Niklas Söderlund
2011-10-13 18:56 ` Borislav Petkov
2011-10-13 19:03 ` Luck, Tony
2011-10-13 19:14 ` Borislav Petkov
2011-10-13 20:04 ` Mauro Carvalho Chehab [this message]
2011-10-13 20:03 ` Niklas Söderlund
2011-10-13 20:06 ` Mauro Carvalho Chehab
2011-10-13 20:52 ` [PATCHv2] " Niklas Söderlund
2012-01-29 1:26 ` Niklas Söderlund
2012-01-29 2:01 ` Jesper Juhl
2012-01-29 22:04 ` [PATCHv3] " Niklas Söderlund
2012-01-29 22:14 ` Jesper Juhl
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=4E97445F.2040509@redhat.com \
--to=mchehab@redhat.com \
--cc=bp@amd64.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=niso@kth.se \
--cc=tony.luck@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox