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

RE: git on HP NonStop

From
Joachim Schmitz <jojo@schmitz-digital.de>
Date
Aug 20, 2012, 11:27 UTC
Message-ID
<001101cd7ec6$c038ba60$40aa2f20$@schmitz-digital.de>
In-Reply-To
<503217F2.5070105@viscovery.net>
Show 16 quoted lines
> From: Johannes Sixt [mailto:j.sixt@viscovery.net]
> Sent: Monday, August 20, 2012 12:57 PM
> To: Joachim Schmitz
> Cc: 'Jan Engelhardt'; 'Junio C Hamano'; git@vger.kernel.org
> Subject: Re: git on HP NonStop
> 
> Am 8/20/2012 12:36, schrieb Joachim Schmitz:
> > int var = var;
> > char *othervar = othervar;
> >
> > ...
> >
> > What is the reason for using that self-init stuff? I don't think it is
> > really portable, is it?
> 
> It is used to avoid "var may be used uninitialized" warnings for some
compilers.

Well, it results in a similar warning on NonStop. "var is used before it is set" and I think this is equally bad. In either case we don't know what the content of that var is.

E.g. in wt_status.c the variable 'status' is set at only one place, but later it is switched on. If lucky we get to the default case and die. So why not just int status = 0;

> Officially (according to the C standard), it is undefined behavior. 
Yes, I had that suspicion. Not good to rely in this...
> But I've observed considerable resistance by Junio to fix this properly. 
What's the  reason behind that?
> Therefore, unless
> you can show that your compiler generates unusable code you better live
with
> the "self-initialization" warnings.
So far I can't, so I guess I'll have to live with the warnings, but don't
quite like it.
 
> -- Hannes
Bye, Jojo
Previous: Johannes SixtNext: Junio C Hamano
Message 5 of 11 in “RE: git on HP NonStop”
  1. Joachim SchmitzAug 14, 2012
  2. Jan EngelhardtAug 19, 2012
  3. Joachim SchmitzAug 20, 2012
  4. Johannes SixtAug 20, 2012
  5. Joachim SchmitzAug 20, 2012
  6. Junio C HamanoAug 20, 2012
  7. Joachim SchmitzAug 20, 2012
  8. Junio C HamanoAug 21, 2012
  9. Joachim SchmitzAug 22, 2012
  10. Andreas EricssonAug 23, 2012
  11. Joachim SchmitzAug 23, 2012

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.