From: Wolfgang Denk Date: Wed, 28 Nov 2012 21:30:40 +0100 Subject: [U-Boot] [PATCH V4 04/11] imximage: prepare to move static variables to struct data_src In-Reply-To: <50B659AD.9090704@boundarydevices.com> References: <1349315254-21151-9-git-send-email-troy.kisky@boundarydevices.com> <1354066303-29762-1-git-send-email-troy.kisky@boundarydevices.com> <1354066303-29762-5-git-send-email-troy.kisky@boundarydevices.com> <20121128093819.55DD620104E@gemini.denx.de> <50B659AD.9090704@boundarydevices.com> Message-ID: <20121128203040.E6C6B201208@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Troy Kisky, In message <50B659AD.9090704@boundarydevices.com> you wrote: > > > Could you please elucidate why exactly this is _needed_? > > My goal was to reduce the number of static variables, but strictly speaking > it has little benefit other than giving me a warm fuzzy feeling. > > I'm not that only one that dislikes static though. ... > ds is on the stack, and even if not needed now, I like to avoid future > random bugs. Did you check the impact of your changes on the memory footprint? Changing code that uses a static variable initialized (implicitly or explicitly) to zero [which results in allocation of the BSS segment, i. e. zero space in the code or in the image file] into real code is something that is a bit of expensive just for satisfying random "dislikes". I think you should better leave that as is. The code is pretty efficent that way, and you increase it for little or no benefit. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The nice thing about standards is that there are so many to choose from. - Andrew S. Tanenbaum