[PATCH 2/3] flash_eraseall: move constants out of for loop
Mike Frysinger
vapier.adi at gmail.com
Tue Jun 22 22:11:01 EDT 2010
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
> 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";
-mike
More information about the linux-mtd
mailing list