git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] Fix variable initialization in insert_packed_refs().

From
Richard Weinberger <richard@nod.at>
Date
Jan 15, 2010, 11:02 UTC
Message-ID
<201001151202.38762.richard@nod.at>
In-Reply-To
<4B501A9D.6060703@viscovery.net>
Am Freitag 15 Januar 2010 08:34:53 schrieb Johannes Sixt:
Show 5 quoted lines
> If you look around in the code, you'll find more *cough* initializations
> *cough* like this. They are written this way for a reason: they avoid
> unwarranted compiler warnings "'foo' may be used uninitialized". Are you
> saying that this warning is not triggered anymore after your change?
> 

I don't get a warning after my change. But I'm using on this system a quite old gcc (4.3.1). I'll recompile git with a more recent gcc and see what happens.

Just for clarification: "int cmp = cmp;" *suppresses* only the warning but "cmp" is still uninitialized? (I did'nt know this trick before.)

//richard
Previous: Johannes Sixt
Message 3 of 3 in “Fix variable initialization in insert_packed_refs().”
  1. 2/2 Fix variable initialization in insert_packed_refs().Richard Weinberger, Jan 14, 2010
  2. Johannes SixtJan 15, 2010
  3. Richard WeinbergerJan 15, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.