From: Jamie Lokier <jamie@shareable.org>
To: Mike Frysinger <vapier.adi@gmail.com>
Cc: "Bityutskiy Artem \(Nokia-D/Helsinki\)"
<Artem.Bityutskiy@nokia.com>,
linux-mtd@lists.infradead.org,
"Shevchenko Andriy \(EXT-Teleca/Helsinki\)"
<ext-andriy.shevchenko@nokia.com>
Subject: Re: [PATCH 2/3] flash_eraseall: move constants out of for loop
Date: Thu, 24 Jun 2010 01:39:54 +0100 [thread overview]
Message-ID: <20100624003954.GK7058@shareable.org> (raw)
In-Reply-To: <AANLkTimllsVj3nGC7vWP9oKPJXwIyjd71y0KbA7rFhPH@mail.gmail.com>
Mike Frysinger wrote:
> On Tue, Jun 22, 2010 at 20:23, Jamie Lokier wrote:
> > Mike Frysinger wrote:
> >> i wonder though why this code even bothers with "static".
> >
> > The array is static to avoid compiling to code which fills in the
> > array at runtime. I.e. it makes the code smaller, to the same size as
> > if they were globals. And then, only because its static, the const
> > can put them in the .rodata section, reducing unshared data size.
>
> if it were generated on the stack at runtime, the .text is shared too
Shared, but larger than the static-const data it replaces.
> > Because they're static there's no benefit to moving them to another
> > scope.
>
> that's sort of what i expected, but i found it odd that it isnt:
> static const char * const short_options = "jq";
You're right, I missed that.
I'd have used this myself:
static const char short_options[] = "jq";
-- Jamie
prev parent reply other threads:[~2010-06-24 0:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-17 8:42 [PATCH 1/3] mkfs.ubifs: check output first Shevchenko Andriy (EXT-Teleca/Helsinki)
2010-06-17 8:42 ` [PATCH 2/3] flash_eraseall: move constants out of for loop Shevchenko Andriy (EXT-Teleca/Helsinki)
2010-06-17 8:42 ` [PATCH 3/3] flash_eraseall: make -? option the same as --help Shevchenko Andriy (EXT-Teleca/Helsinki)
2010-06-22 17:31 ` Mike Frysinger
2010-06-22 17:33 ` [PATCH 2/3] flash_eraseall: move constants out of for loop Mike Frysinger
2010-06-23 0:23 ` Jamie Lokier
2010-06-23 2:11 ` Mike Frysinger
2010-06-24 0:39 ` Jamie Lokier [this message]
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=20100624003954.GK7058@shareable.org \
--to=jamie@shareable.org \
--cc=Artem.Bityutskiy@nokia.com \
--cc=ext-andriy.shevchenko@nokia.com \
--cc=linux-mtd@lists.infradead.org \
--cc=vapier.adi@gmail.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;
as well as URLs for NNTP newsgroup(s).