From: Shawn O. Pearce Date: Thu, 09 Oct 2008 19:17:27 GMT Subject: Re: [RFC PATCH 1/2] Replace memset(0) with static initialization where possible Message-ID: <20081009191727.GY8203@spearce.org> In-Reply-To: Brandon Casey wrote: > Is there interest in a patch like this? I think this is not a worthwhile change. > "Possible" benefits: > > 1) more concise, so it improves readability in most cases I'm not sure. Maybe I'm just too used to reading memset(&foo, 0, sizeof(foo)), but {{0},} seems very difficult to read. > 2) gives compiler more flexibility when optimizing Shouldn't a good C compiler notice something like a memset and inline it when possible? They already can inline strlen on a constant. > Drawbacks: > > 1) many lines touched for no functional change That's a pretty big drawback. What happens when a struct gets a struct as its first member? Do all the {0,} inits for it have to change to {{0,},} ? -- Shawn.