From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2.shareable.org ([80.68.89.115]) by bombadil.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1ORDki-0007hH-CE for linux-mtd@lists.infradead.org; Wed, 23 Jun 2010 00:23:40 +0000 Date: Wed, 23 Jun 2010 01:23:35 +0100 From: Jamie Lokier To: Mike Frysinger Subject: Re: [PATCH 2/3] flash_eraseall: move constants out of for loop Message-ID: <20100623002334.GA22367@shareable.org> References: <1276764159-28726-1-git-send-email-ext-andriy.shevchenko@nokia.com> <1276764159-28726-2-git-send-email-ext-andriy.shevchenko@nokia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: "Bityutskiy Artem \(Nokia-D/Helsinki\)" , linux-mtd@lists.infradead.org, "Shevchenko Andriy \(EXT-Teleca/Helsinki\)" List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Mike Frysinger wrote: > NAK: no explanation why you're doing this, and current code has the > variables scoped to where they actually get used. > > 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. Because they're static there's no benefit to moving them to another scope. -- Jamie