> From: Johannes Sixt [mailto:j.s...@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

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
> 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

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to