Re: [PATCH 8/4] match-trees: drop "x = x" initializations
- From
Jeff King <peff@peff.net>
- Date
- Mar 22, 2013, 21:36 UTC
- Message-ID
- <20130322213628.GA7471@sigill.intra.peff.net>
- In-Reply-To
- <7vtxo35dcz.fsf@alter.siamese.dyndns.org>
On Fri, Mar 22, 2013 at 02:33:16PM -0700, Junio C Hamano wrote:
Show 15 quoted lines
> Junio C Hamano <gitster@pobox.com> writes: > > > These three are all updated by the same tree_entry_extract() call, > > and whenever we use mode[12] we use path[12], so if it decides path1 > > is used or assigned, it should be able to tell mode1 is, too. > > > > Unsatisfactory, it surely is... > > And immediately after I wrote the above, I am greeted by this: > > gcc (Debian 4.4.5-8) 4.4.5 > match-trees.c:75: error: 'elem1' may be used uninitialized in this function > match-trees.c:77: error: 'path1' may be used uninitialized in this function > > and this crazy one on top squelches it.
Ugh, yeah, I should have tried with more compilers. 4.6 complains, but 4.7 doesn't (although I still find it really weird that 4.7 gets it _half_ right).
> I'll initialize all of them to nonsense values for now.
I think that's sensible.
-Peff