RE: git on HP NonStop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Johannes Sixt [mailto:j.sixt@xxxxxxxxxxxxx]
> Sent: Monday, August 20, 2012 12:57 PM
> To: Joachim Schmitz
> Cc: 'Jan Engelhardt'; 'Junio C Hamano'; git@xxxxxxxxxxxxxxx
> 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

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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]